[DB-SIG] API suggestion: expose 'quote' method
jacobs at penguin.theopalgroup.com
Tue Jun 3 15:56:45 EDT 2003
On Tue, 3 Jun 2003, Chris Cogdon wrote:
> > Implementing generic quoting properly often requires that a fair amount
> > of type-metadata is available. It is more the job of a
> > object/relational mapper than a low-level DB-API driver, although a
> > DB-API driver can do it with some help from the backend. Please do not
> > be mislead by some of the simplistic (and wrong) implementations that
> > you may find laying around.
> The API is responsible for knowing the requirements of the DMBS. That's
> what it's *FOR* :)
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.
I still suggest that you try writing a generic quoting library for your
application. At minimum you'll find out first hand how tricky it is. At
best, you'll end up with a nice tool that can then be shared with others.
The OPAL Group - Enterprise Systems Architect
Voice: (216) 986-0710 x 19 E-mail: jacobs at theopalgroup.com
Fax: (216) 986-0714 WWW: http://www.theopalgroup.com
More information about the DB-SIG