Re: paramstyle without knowing the database

"M.-A. Lemburg" <[email protected]>
Newsgroups gmane.comp.python.db
Organization eGenix.com Software GmbH; http://www.egenix.com/
Message-ID <[email protected]>
On 04.12.2012 15:55, wilk wrote:
> 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 ?

There's one such module in the PyDal package:

http://pydal.sourceforge.net/

called paramstyles.py:

https://pydal.svn.sourceforge.net/svnroot/pydal/trunk/dal/dbapi/paramstyles.py

which is an N-way converter.

> 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.
>>
> 
> 

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Dec 04 2012)
>>> Python Projects, Consulting and Support ...   http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ...       http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2012-11-28: Released eGenix mx Base 3.2.5 ...     http://egenix.com/go36
2013-01-22: Python Meeting Duesseldorf ...                 49 days to go

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/
_______________________________________________
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.