Skip to content

Commit 200dd8e

Browse files
committed
I'm sending you a small patch to pgdb.py module. This
raises pgdb.DatabaseError when any of the fetch* methods was invoked but previous call to execute* did not produce any result set or no call was issued yet. Also, raises pgdb.NotSupportedError when .nextset() is invoked, instead of NameError. This behaviour complies with DB-API 2.0. Thanks for your work! Timur Irmatov.
1 parent a4bc5ee commit 200dd8e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/interfaces/python/pgdb.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,10 @@ def fetchmany(self, size = None, keep = 1):
240240
size = self.arraysize
241241
if keep == 1:
242242
self.arraysize = size
243-
res = self.__source.fetch(size)
243+
244+
try: res = self.__source.fetch(size)
245+
except _pg.error, e: raise DatabaseError, str(e)
246+
244247
result = []
245248
for r in res:
246249
row = []
@@ -253,6 +256,9 @@ def fetchmany(self, size = None, keep = 1):
253256
result.append(row)
254257
return result
255258

259+
def nextset(self):
260+
raise NotSupportedError, "nextset() is not supported"
261+
256262
def setinputsizes(self, sizes):
257263
pass
258264

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy