[cx-oracle-users] Custom cursor segfaults
Brought to you by:
atuining
From: Leith P. <le...@sl...> - 2004-11-10 00:46:19
|
Hello all, Just a quick question, ive created a custom cursor that returns result sets as dicts, following on from the previous posts about custom cursors segfaulting, i modified my the code to pass the connection to the cursor. It all seems to work fine with a simple test rig, however when i combine my module with Warren Smiths DbConnectionPool, i get a segfault when returning a result set. Warrens module can be found at http://www.wandrsmith.net/~warren/DbConnectionPool.py Here is my DictWrapper module (Using 4.1 beta) If you could provide some pointers, or if you require any further debugging info please let me know. The system is Oracle 8i with corresponding drivers. --- snip --- from cx_Oracle import * # DictCursor for Oracle, returns dicts instead of tuples class DictConnect(Connection): def cursor(self): return DictCursor(self) class DictCursor(Cursor): def fetchall(self): r = Cursor.fetchall(self) result = [] for l in r: result.append( dict([(a[0],b) for a,b in zip(self.description, l)]) ) return result def fetchone(self): return dict([(a[0],b) for a,b in zip(self.description, Cursor.fetchone(self))]) # factory class def connect(**kw): return DictConnect(**kw) --- snip --- The test rig --- snip --- import OracleUtil db = OracleUtil.connect(user='****', password='****', dsn='oracle') c = db.cursor() print c c.execute('select * from some_table where x = 3') print c.fetchall() db.close() |