[TransWarp] pgdb.py from PostgreSQL 7.3.2
Radek Kanovsky
rk at dat.cz
Fri Feb 14 11:05:51 EST 2003
Hello,
I have a problem with PEAK and PostgreSQL 7.3.2. Every SQL query ends
with exception NotSupportedError. When peak find method nextset() in
Cursor, then it calls it. But calling pgdbCursor.nextset() raises
exception NotSupportedError. When I disable nextset() in pgdb.py source
(renaming it to 'XnextsetX'), everything works OK.
file pgdb.py:
class pgdbCursor:
[....]
def nextset(self):
raise NotSupportedError, "nextset() is not supported"
[....]
Here is my testing code for sure:
from peak.api import storage
from peak.storage import SQL
class Address:
server = None
db = 'test'
user = 'radekk'
passwd = None
con = SQL.PGSQLConnection(address = Address)
print (~("SELECT VERSION();"))[0]
There was no method pgdbCursor.nextset() in 7.2.4 version of PostgreSQL.
If I understand DBAPI 2.0 correctly, pgdb.py behaviour follows
specification. So I have made small patch:
--- /home/radekk/work/PEAK/src/peak/storage/SQL.py
+++ /usr/local/python-2.2.2/lib/python2.2/site-packages/peak/storage/SQL.py
@@ -77,7 +77,10 @@
def nextset(self):
- return getattr(self._cursor, 'nextset', _nothing)()
+ try :
+ return getattr(self._cursor, 'nextset', _nothing)()
+ except self.conn.API.NotSupportedError :
+ return None
def execute(self, *args):
Is NotSupportedError dereferencing through self.conn.API correct?
Regards
Radek Kanovsky
More information about the PEAK
mailing list