[DB-SIG] Escaping Placeholders
Federico Di Gregorio
fog at initd.org
Tue Jul 6 20:49:05 CEST 2004
Lì martedì, 2004/07/06 alle 20:39, +0200, Peter L. Buschman ha scritto:
> Andy:
>
> Thanks. Are you saying there is no explicit escaping of placeholders? If
> so, that actually makes my problem
> somewhat easier as I am working on a set of translation routines to convert
> from any paramstyle to any other
> paramstyle. Going from ?,?,? to :1,:2:,:3, :param1,:param2,:param3,
> %s,%s,%s, or :%(param1)s,%(param2)s,%(param3)s
placeholders (at least the pythonic ones) should be escapeable. just try
to write the following query without using the '%%' escape sequence:
SELECT id, name, type, data FROM zot
WHERE name LIKE '%%side' AND type = %s
now, if you can't tell .execute() that the first % is really a % by
using the %% escape, what would you do?
psycopg just uses python rules and correctly manage the %% escape.
--
Federico Di Gregorio http://people.initd.org/fog
Debian GNU/Linux Developer fog at debian.org
INIT.D Developer fog at initd.org
Spesso crescere ed andare a vivere da soli è l'unico modo di restare
bambini. -- Alice Fontana
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Questa parte del messaggio =?ISO-8859-1?Q?=E8?= firmata
Url : http://mail.python.org/pipermail/db-sig/attachments/20040706/9fabb016/attachment.pgp
More information about the DB-SIG
mailing list