Re: [cx-oracle-users] Paramstyle (RE: cx_Oracle 4.1)
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2005-10-19 13:36:39
|
You can't truly choose what paramstyle you would like to use. Oracle only natively supports named and numeric paramstyles and cx_Oracle supports both of those. If you want anything else you will have to write code for it yourself. That said, its fairly straightforward to translate between qmark and numeric -- they both accept a list of arguments. You simply have to convert the SQL that is passed in, replacing each ? with a corresponding :<n>. If you create a subclass of cx_Oracle.Cursor and override the execute() and prepare() methods you can do precisely that. Note that your desire for choosing the paramstyle is shared by a fair number of others. This debate is held on the db-sig mailing list every once in a while but no solution ever appears. :-) On 10/19/05, Luiz Carlos Geron <lui...@gm...> wrote: > Hi All, > From http://sourceforge.net/mailarchive/message.php?msg_id=3D10645555 : > > " 13) Added support for binding by position (paramstyle =3D "numeric")." > > I want to choose what paramstyle to use in my code. There is one > reason for this: I want to write such a code that can be used with > diferent db modules (like kinterbasdb, mssql, whatever) without > modifiyng it. The kinterbasdb module simply doesn't support other > paramstyle than qmark, then I have to use the same paramstyle on > cx_oracle and other possible modules. How can I choose what > paramstyle to use with cx_oracle? If I can't, how can I solve this > problem, using the same code to other databases ? (for now, I consider > only Firebird) > > Thanks, and sorry for my bad english > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Power Architecture Resource Center: Free content, downloads, discussions, > and more. http://solutions.newsforge.com/ibmarch.tmpl > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |