I'm sending you a small patch to pgdb.py module. This
authorD'Arcy J.M. Cain <darcy@druid.net>
Mon, 25 Nov 2002 03:11:15 +0000 (03:11 +0000)
committerD'Arcy J.M. Cain <darcy@druid.net>
Mon, 25 Nov 2002 03:11:15 +0000 (03:11 +0000)
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.

src/interfaces/python/pgdb.py

index 78ca61ade52058478df1d750a0b8ae44edd7ad8e..62b551b9954c76fbe28f283d14ca2a033da9b949 100644 (file)
@@ -240,7 +240,10 @@ class pgdbCursor:
                        size = self.arraysize
                if keep == 1:
                        self.arraysize = size
-               res = self.__source.fetch(size)
+
+               try: res = self.__source.fetch(size)
+               except _pg.error, e: raise DatabaseError, str(e)
+
                result = []
                for r in res:
                        row = []
@@ -253,6 +256,9 @@ class pgdbCursor:
                        result.append(row)
                return result
 
+       def nextset(self):
+               raise NotSupportedError, "nextset() is not supported"
+
        def setinputsizes(self, sizes):
                pass