Re: [cx-oracle-users] Custom cursor segfaults
Brought to you by:
atuining
From: Leith P. <le...@sl...> - 2004-11-10 04:00:42
|
Just a quick update, the production code differed slightly from the test rig, so that problem has been fixed. However trying to catch DatabaseError exceptions causes the same problem. What is the work around in this instance? On Wed, Nov 10, 2004 at 11:46:18AM +1100, Leith Parkin wrote: > 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() > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Sybase ASE Linux Express Edition - download now for FREE > LinuxWorld Reader's Choice Award Winner for best database on Linux. > http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |