[PEAK] DB type conversion (for inputs to execute() and callproc())
Ian Bicking
ianb at colorstudy.com
Tue Dec 16 21:07:43 EST 2003
On Dec 16, 2003, at 7:09 PM, Phillip J. Eby wrote:
> Bleah. AFAICT, the only really messy bit, though, is mapping a Python
> type that might have multiple possible representations in the target
> DB, when the target protocol isn't specifically known. For example,
> if you don't have a 'db.types.BOOLEAN' for the driver, and/or don't
> know that 'BOOLEAN' is the target type in the DB.
Oh, just to make it a little more difficult, you can have types that
the driver knows how to handle, but you won't know how to handle. For
instance, Access uses something like #MM-DD-YYYY HH:MM:SS# for date
literals (at least, that's what someone said, I haven't used it). If
you access Access through the ODBC driver and use parameters, the
driver can do the appropriate quoting. You don't even have to know
that the ODBC target is Access -- another database that doesn't have
silly date representations will work with the same code. However,
there is no interface to determine the proper string representation of
a date. (And there's no standard interface for parameters either)
Anyway, it's something to keep in mind. SQLObject doesn't handle this,
because it just seemed too damn annoying, but you might want to.
--
Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org
More information about the PEAK
mailing list