[DB-SIG] API suggestion: expose 'quote' method

Chris Cogdon chris at cogdon.org
Wed Jun 4 18:06:18 EDT 2003

On Wednesday, Jun 4, 2003, at 01:02 US/Pacific, M.-A. Lemburg wrote:

> Chris Cogdon wrote:
>> But... I DO understand the difficulty in exposing a function that 
>> doesn't currently exist (such as the ODBC driver). And it may NOT be 
>> worth the difficulty in adding that functionality as a requirement 
>> for a later API. (Perhaps optional? At least if it's doable, we could 
>> get a consistent interface).
> That we could do, but note that quoting would be requiring type
> information in database specific ways, plus it may sometimes also
> need encoding or code page information for string values, e.g.
> a database running with UTF-8 code page will want to see UTF-8
> in string literals.

I believe the python driver ALREADY has access to this information, 
since it needs it to determine how to correctly pass this information 
to the DBMS, be it in a string or binary format. I do agree, however, 
that converting to string format is a) non-trivial, especially if 
you're not doing it already, and b) prone to precision loss in the case 
of floating point numbers. Both of those issues are not insurmountable, 
and do not make the feature particularly less useful.

I DO appreciate the amount of work that the driver writers have done in 
interpreting the DMBS specifications, requirements and APIs, and 
turning them into a python driver that is useful. Thank you! That 
doesn't preclude me asking or suggesting for extensions to the API 
specification to make the application writer's job easier... otherwise, 
we would be all dealing with 'trivial wrappers' geared to make the 
driver-writer's life easier.

My initial request was born from a feature that I thought would be 
useful, and would like to have seen in a 'standard interface', be it a 
required or optional part of the next specification.

(If it's any consolation, I spend 20-30 hours each week on the 
community artwork site I run, and sometimes I'm feeling pretty damn 
under-appreciated as well. So, rest assured, I'm certainly 'passing the 
favour on'... if you're not using my website yourself, perhaps you're 
using the fruits of the efforts of someone who is)

    ("`-/")_.-'"``-._        Chris Cogdon <chris at cogdon.org>
     . . `; -._    )-;-,_`)
    (v_,)'  _  )`-.\  ``-'
   _.- _..-_/ / ((.'
((,.-'   ((,/   fL

More information about the DB-SIG mailing list