From: Mike Bayer Date: Wed, 28 Mar 2007 00:09:55 +0000 (+0000) Subject: - fix for fetchmany() "size" argument being positional in most X-Git-Tag: rel_0_3_7~103 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04914527998024494d19ba15ec0d29b8f2d2215b;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - fix for fetchmany() "size" argument being positional in most dbapis [ticket:505] --- diff --git a/CHANGES b/CHANGES index 6830ee00ea..fd8564e784 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,8 @@ accessor on the parent Selectable so theres no need to be aware of the genrerated label names [ticket:512]. - preliminary support for unicode table and column names added. + - fix for fetchmany() "size" argument being positional in most + dbapis [ticket:505] - orm: - improved/fixed custom collection classes when giving it "set"/ "sets.Set" classes or subclasses (was still looking for append() diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index eb397d7743..84ad6478fd 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -968,7 +968,7 @@ class ResultProxy(object): if size is None: rows = self.cursor.fetchmany() else: - rows = self.cursor.fetchmany(size=size) + rows = self.cursor.fetchmany(size) l = [] for row in rows: l.append(RowProxy(self, row)) diff --git a/test/sql/query.py b/test/sql/query.py index 6683fa0d04..2247418675 100644 --- a/test/sql/query.py +++ b/test/sql/query.py @@ -53,7 +53,17 @@ class QueryTest(PersistTest): for row in r: l.append(row) self.assert_(len(l) == 3) - + + def test_fetchmany(self): + self.users.insert().execute(user_id = 7, user_name = 'jack') + self.users.insert().execute(user_id = 8, user_name = 'ed') + self.users.insert().execute(user_id = 9, user_name = 'fred') + r = self.users.select().execute() + l = [] + for row in r.fetchmany(size=2): + l.append(row) + self.assert_(len(l) == 2, "fetchmany(size=2) got %s rows" % len(l)) + def test_compiled_execute(self): s = select([self.users], self.users.c.user_id==bindparam('id')).compile() c = testbase.db.connect()