[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    Re: [GENERAL] Error in PostgreSQL query with psycopg
From:       "Harald Armin Massa" <haraldarminmassa () gmail ! com>
Date:       2006-07-31 20:30:55
Message-ID: 7be3f35d0607311330n2801cae3u3ccaef26cb47b74e () mail ! gmail ! com
[Download RAW message or body]

Parthan,

never, never, never try quoting on your own! You can only fail. The only
choice is to fail now or later.

The only recommended way with Python and DBAPI2.0 is:

lala="huibuh"
cs.execute ("select bla from foo where schupp=%s", (lala,))

or better

cs.execute ("select bla from foo where schupp=%(lala)s",
dict(lala="huibuh"))

(that's with psycopg2)

Harald




-- 
GHUM Harald Massa
persuadere et programmare
Harald Armin Massa
Reinsburgstraße 202b
70197 Stuttgart
0173/9409607
-
Let's set so double the killer delete select all.

[Attachment #3 (text/html)]

Parthan,<br><br>never, never, never try quoting on your own! You can only fail. The \
only choice is to fail now or later.<br><br>The only recommended way with Python and \
DBAPI2.0 is:<br><br>lala=&quot;huibuh&quot;<br>cs.execute  (&quot;select bla from foo \
where schupp=%s&quot;, (lala,))<br><br>or better<br><br>cs.execute (&quot;select bla \
from foo where schupp=%(lala)s&quot;, dict(lala=&quot;huibuh&quot;))<br><br>(that's \
with psycopg2)<br><br>Harald <br><br><br><br clear="all"><br>-- <br>GHUM Harald \
Massa<br>persuadere et programmare<br>Harald Armin Massa<br>Reinsburgstraße \
202b<br>70197 Stuttgart<br>0173/9409607<br>-<br>Let's set so double the killer delete \
select all.



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic