[DB-SIG] Table Oriented Programming
farcepest at gmail.com
Sat Jan 29 16:50:52 CET 2005
On Sat, 29 Jan 2005 17:04:38 +0300, Denis S. Otkidach <ods at strana.ru> wrote:
> On Sat, 29 Jan 2005 13:21:14 +0100
> Federico Di Gregorio <fog at initd.org> wrote:
> > Il giorno ven, 28-01-2005 alle 15:11 -0600, Ian Bicking ha scritto:
> > > It doesn't use bound parameters like ?, instead it does all the SQL
> > > generation itself including quotation. So it has to know what
> > > database you are using to actually create the SQL, like "mysql",
> > > "postgresql", etc.
> > This is.. er.. "horrible". PostgreSQL supports a *lot* of different
> > types and the only way to support them all is to let the driver do the
> > quoting (possibly with the user adding its own quoting rules, see
> > PEP-246 adapt() in psycopg 2). I suppose your driver is not quoting
> > PostGis or or even simple geometrical types mapped to Python
> > instances, right?
> AFAIK, Oleg Broytmann is working on changing SQLObject to use bound
> parameters. But there is a lot of work and probably compatibility
> issues. Anyway, builder must know database adapter to use appropriate
All it has to do is look at modules.paramstyle to figure this out. I
did a little work along these lines at one point, and if you construct
your query using %s as the placeholder (which is likely what happens
already), you can put the right placeholders in there fairly easily.
With module.paramstyle = "qmark", you can do something like this:
query2 = query % ('?',) * len(params)
Computer interfaces should never be made of meat.
Using GMail? Setting Reply-to address to <> disables this annoying feature.
More information about the DB-SIG