Re: [cx-oracle-users] Modifying fetched data python types for zope adaptor
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2006-11-09 22:03:03
|
If you pass in the datetime variable then yes, you construct the returned object twice. Passing a string would imply parsing would be necessary which is less than ideal. Passing in a series of integers (year, month, day, hour, minute, second, fsecond) would imply the construction of six integers -- which may or may not be faster than the construction of a datetime variable. Regardless of all that, however, it would perform better than subclassing a cursor and massaging all of the data that is returned.... Anyone else care to comment? On 11/9/06, Andy Hird <and...@gm...> wrote: > One thought I had after getting some sleep is that passing in the types > cx_Oracle normally returns means you end up constructing the returned object > twice anyway and you lose some of the performance benefits of doing this. > I'm not sure whether building a string to pass into settype is much less > work or not. > > Andy > > > > > > > Which really is pretty much the same as your settype(cx_Oracle.DATETIME, > <YourTypeOrMethod>). I guess the one thing they do in common is pass a > string to the conversion method, although it'd probably be as simple to pass > cx_Oracles native value for the given type, i.e. a datetime (or > cx_Oracle.Date) for cx_Oracle.DATETIME and so on. After all if I'm defining > the conversion methods then I should know what I'd be getting. > > > > Thanks again in advance. Sorry for going on so long there. > > > > Andy > > > > > > > > > > On 11/9/06, Anthony Tuininga < ant...@gm...> wrote: > > > 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? > > > > > > > ------------------------------------------------------------------------- > 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 > > > |