Re: paramstyle without knowing the database

wilk <[email protected]>
Newsgroups gmane.comp.python.db
Message-ID <[email protected]>
On 03-12-2012, M.-A. Lemburg wrote:
> On 03.12.2012 09:31, wilk wrote:
>> Hi,
>> 
>> I did a litle function to use the same paramstyle regardless of the 
>> paramstyle of the database. I transform one paramstyle to an other (a 
>> code missing in the lib standard isn't it ?)
>
> There are a few such libraries out there which take care of
> such conversions. 

Do you have a link to one that do only that ?

Thanks for the clue about dbapi 3.0


> The standard itself cannot provide an example
> implementation.
>
>> But of course i need to know the paramstyle of the database. I didn't 
>> found any way to retrieve it from the connexion. Did i missed 
>> something ?
>
> No, the standard only defines a per module global for the
> paramstyle.
>
> We might want to extend this to connections and cursors
> as well in DB APi 3.0, to make it easier to write such conversion
> routines, and then perhaps also make those attributes writable,
> so that the paramstyle can be adjusted on a per connection and
> cursor basis.
>
>> Is there a project to have one paramstyle mandatory for all the 
>> database ? I'm afraid that because there is not people will not use it 
>> at all and use manual string escape wich is a big security hole (i've 
>> seen that from people comming from php).
>
> For DB-API 3.0 there's a proposal to make support for the two
> paramstyles 'named' and 'qmark' mandatory (but leave all existing
> styles in the standard), or reduce the number of standard
> paramstyles to these two.
>


-- 
William Dodé
Informaticien Indépendant

_______________________________________________
DB-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/db-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.