[DB-SIG] API suggestion: expose 'quote' method
David Rushby
davidrushby at yahoo.com
Tue Jun 3 18:47:26 EDT 2003
--- Chris Cogdon <chris at cogdon.org> wrote:
>
> On Tuesday, Jun 3, 2003, at 16:54 US/Pacific, David Rushby wrote:
>
> > I phrased that poorly. I meant that some DBMSes "have a quoting
> > convention", yet don't expose it in their *native* C clients APIs,
>
> Actually, I don't expect any DBMS client library to expose a quoting
> function. They tend to be very minimalist :)
>
> > which makes exposure in the Python driver immaterial (unless the
> > author of the Python driver were to write his own quoting code,
> > which would be error-prone and likely to break or not be extended
> > to new data types across DBMS versions).
>
> That's the python driver writer's JOB, to support changes in the
> underlying DBMS, making those changes invisible to the application
> writer. Inside the python driver is EXACTLY the right place for this
> function.
>
> If the DMBS client library is nice enough to supply a quoting function
> (either detecting or not detecting types), then the python driver
> writer could very well use the function if he or she wished, of course.
>
> Additionally, if new data types were added, then applications using the
> driver would simply not have access to these types until the driver was
> changed. What's the problem, here?
"If the DMBS client library is nice enough to supply a quoting function
(either detecting or not detecting types)"? How would the quoting facility
be of any value if it didn't detect types?
As Kevin said in a previous mail:
"""
Yes, and it works when binding because there is enough context to map each
parameter to a particular SQL type. Generic quoting without that context is
simply not possible without significant infrastructure or meta-data. It is
a great deal harder than exposing an internal method that already exists
within a driver.
"""
Without support from the native database client library, the Python driver
would have to fully parse the SQL statement, determine the internal types of
all the fields its parameters refer to (by looking up metadata in the system
tables), and then perform the quoting.
I say that's well outside "the python driver writer's JOB".
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
More information about the DB-SIG
mailing list