implemented fetchmany and other features for compatibility with the DB API 2.0

This commit is contained in:
Jean-Francois Dockes
2012-12-21 21:18:01 +01:00
parent 8504d70e08
commit 08deef8cc5
2 changed files with 133 additions and 33 deletions
+6 -4
View File
@@ -56,12 +56,14 @@ def doquery(db, q):
m = ptrmeths(groups)
# Print results:
print "Result count: ", nres
print "Result count: ", nres, query.rowcount
if nres > 20:
nres = 20
while query.next >= 0 and query.next < nres:
doc = query.fetchone()
print query.next, ":",
results = query.fetchmany(nres)
for doc in results:
# while query.next >= 0 and query.next < nres:
# doc = query.fetchone()
# print query.next, ":",
#for k,v in doc.items().items():
#print "KEY:", k.encode('utf-8'), "VALUE", v.encode('utf-8')
#continue