Re: [cx-oracle-users] Modifying fetched data python types for zope adaptor
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2006-11-08 15:26:02
|
There is no way of hooking into the returning of date objects. You'll have to hook the entire result set. You can do that quite easily by subclassing cx_Oracle.Cursor and overriding fetchone(), fetchmany() and fetchall() to transform any datetime.datetime entities into Zopes DateTime objects. Clearly there is a performance penalty in doing this. If you can suggest an alternative that would eliminate the performance penalty I'd be happy to entertain it. Perhaps something along the lines of settype(cx_Oracle.DATETIME, <YourTypeOrMethod>) which would then call <YourTypeOrMethod> with a particular set of parameters? Any thoughts on this? On 11/7/06, Andy Hird <and...@gm...> wrote: > Hi all. > > I've just written a Zope Database Adaptor based on cx_Oracle, unfortunately > the DCOracle adaptor or DBAPI doesn't appear to be maintained any longer. > > The last part of the code I need to do is have the data returned by the zope > adaptor return Zopes DataTime objects instaed of datetime.datetime objects. > > Ideally I'd be able to get cx_Oracle to create objects with Zopes type > DateTime.DateTime when it's building the fetch list of data. Is there anyway > of doing this? Can I replace cx_Oracle.Date safely and have it use that to > build the returned object? > > Is there another way of doing type conversions? > > Thanks for any pointers or help you can give. > > Andy Hird > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > |