Re: [cx-oracle-users] Positional parameters, REF's, BINARY_FLOAT and BINARY_DOUBLE
Brought to you by:
atuining
From: Anthony T. <an...@co...> - 2004-03-03 15:35:38
|
On Wed, 2004-03-03 at 04:28, Danny R. Boxhoorn wrote: > There are many reason to switch from DCOracle2 to cx_Oracle and there are a > few that keep me from switching. > The most important one is that lack of support for positional parameters. > I.e., you cannot do something like > > cursor.execute('select 4 from dual where :1 > 1', 37) > > which DCOracle2 allows you to do. > A workaround is to use named parameters and replace all the occurrences of > :<n> with :p<n> in queries. Given the heavy use of positional parameters in the code I have I would like to avoid rewriting it. > So the questions are: > Is support for positional parameters planned? Yes. Interestingly enough I have had some discussions with another person off the list regarding this very same thing. I ran a few tests and creating lists is twice as fast as creating dictionaries so performance wise it is a worthwhile addition. Besides which, sometimes it is quite convenient to be able to use positional parameters, such as in callproc() and callfunc() where currently I have to transform the list into a dictionary in order to call execute(). So yes, I was leaning towards adding this in 4.1. > How much work would be needed to support positional parameters? That depends on the answers to a couple of questions. In the above code you specify a parameter not inside a list. Does that mean DCOracle2 has the following syntax (Python equivalent) def execute(sql, *args) # where args is all positional parameters OR def execute(sql, args) # where args is a list I personally prefer the first but the DB API indicates that the latter is a requirement. If I continue to use the latter, then all I have to do is check to see if the arguments passed are a list or a dictionary and act accordingly. The rest is fairly straightforward. If you were hoping for the former, then I'd like some answers as to how to make it compatible with the DB API. One possibility is to check to see if only one parameter is passed and if it is a list of dictionary, do the DB API thing; otherwise, take the entire list and pass it through as positional parameters. It smacks of hacking but I can't thing of anything else. Any ideas? BTW, does DCOracle2 supported named parameters as well? Do you know or should I just go look at the source and see what they do? :-) > Another question is about object REFerences. It would be nice if they > would be supported. DCOracle2 support for them is limited to `Segmentation > Fault'. I already had a look and I think I could add support for REF's > myself. But before I do that I would like to know whether that's appreciated > and, more importantly, needed ... is support for REF's planned? [) I have never had occasion to use Oracle "objects" (named types) so I haven't bothered adding support. I don't see that changing soon so although I would be interested in having support added, it isn't high on my priority list at the moment. If you are willing to provide patches, I am willing to add them and I would be very appreciative. :-) > Finally, what about the new BINARY_FLOAT and BINARY_DOUBLE types in 10g. > They are high on my wishlist and I can imagine it's trivial to add support > for them. Again, is this planned? I have just barely looked at 10g so I hadn't really planned anything on that front yet. I know that cx_Oracle compiles and passes the test suite on 10g on Linux but nothing more than that yet. Still, I do remember reading about these in the release notes and I can't see that they would be a problem. So yes, I will definitely add these as soon as I can get some more time to play with 10g. > Thanks for the hard work and the prompt and polite response, You're welcome. > Danny R. Boxhoorn > > Kapteyn Institute / OmegaCEN e-mail: da...@as... > Postbus 800 tel.: +31 (0)50 3634056 > 9700 AV GRONINGEN fax.: +31 (0)50 3636100 > THE NETHERLANDS http://www.astro.rug.nl/omegacen > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users -- Anthony Tuininga an...@co... Computronix Distinctive Software. Real People. Suite 200, 10216 - 124 Street NW Edmonton, AB, Canada T5N 4A3 Phone: (780) 454-3700 Fax: (780) 454-3838 http://www.computronix.com |