[DB-SIG] API suggestion: expose 'quote' method
Chris Cogdon
chris at cogdon.org
Tue Jun 3 19:06:44 EDT 2003
On Tuesday, Jun 3, 2003, at 17:47 US/Pacific, David Rushby wrote:
> "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?
What I'm proposing DOES detect types. Ie, it works exactly the same way
the 'execute' function does (on a string-only DBMS), except it returns
the string, rather than passing it to the DBMS.
> 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".
pyPgSQL and pgdb already do quoting, already parse the SQL statement
looking for the %s markers, and already do type detection, all without
support from the database client library.
--
("`-/")_.-'"``-._ Chris Cogdon <chris at cogdon.org>
. . `; -._ )-;-,_`)
(v_,)' _ )`-.\ ``-'
_.- _..-_/ / ((.'
((,.-' ((,/ fL
More information about the DB-SIG
mailing list