logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: Correct quoting: msg#00024

Subject: Re: Correct quoting
On ven, 2004-08-06 at 15:47 +0200, Markus Bertheau wrote:
> Hi,
> 
> psycopg interpolates
> 
> "SELECT * FROM class_get_properties(%s )ORDER BY %s %s OFFSET %i LIMIT %i", \
>       ('Literaturhinweis', 'property_name', 0, 11)
> 
> to
> 
> SELECT * FROM class_get_properties(Literaturhinweis )ORDER BY property_name 
> asc OFFSET 0 LIMIT 11
> but what I want is
> 
> SELECT * FROM class_get_properties('Literaturhinweis' )ORDER BY property_name 
> asc OFFSET 0 LIMIT 11
> 
> How would I do that correctly? How are developers using psycopg supposed
> to deal with that?

use bound variables:

        curs.execute("SELECT * FROM ...",
           ('Literaturhinweis', 'property_name', 0, 11))

if you're already using bound variables then this is a psycopg bug.
please send minimum working code that exposes the problem. also note
that bound variables can't be unicode strings (not in psycopg 1.x at
least.)

-- 
Federico Di Gregorio                         http://people.initd.org/fog
Debian GNU/Linux Developer                                
fog-8fiUuRrzOP0dnm+yROfE0A@xxxxxxxxxxxxxxxx
INIT.D Developer                                           
fog-NGVKUo/i/6DYtjvyW6yDsg@xxxxxxxxxxxxxxxx
  You should use @literal, but you should have the grace to be
   embarrassed.                                         -- Norman Ramsey

Attachment: signature.asc
Description: Questa parte del messaggio =?ISO-8859-1?Q?=E8?= firmata

_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/+sw@xxxxxxxxxxxxxxxx
http://lists.initd.org/mailman/listinfo/psycopg
<Prev in Thread] Current Thread [Next in Thread>