Re: quoting - bug ?

Gerhard Häring <[email protected]> Fri, 27 Jun 2003 07:05:24 +0200
Newsgroups gmane.comp.python.db.pypgsql.user
Message-ID <[email protected]>
Karsten Hilbert wrote:
> Dear all,
> 
> suppose I want to find occurrences of "test" in a column
> "data" in a table "testtable". SQL would be:
> 
> select * from testtable where data='test';
> 
> Rewriting that for use with pyPgSQL:
> 
> query = "select * from testtable where data=%s;"
> arg = "test"
> curs.execute(query, arg)
> 
> Right ? [...]

No. It's probably entirely unrelated to your problem and just one of my 
favourite nitpicks, but the semicolon is a statement *separator*, not an 
end-of-statement character. The Python DB-API only allows to send one 
statement per .execute() call, so don't use the semicolon when using the 
DB-API.

-- Gerhard


-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php