Re: [RFC] ideas for a new Python DBAPI driver (was Re: libpq test suite)

From: Marko Tiikkaja <pgmail(at)joh(dot)to>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Manlio Perillo <manlio(dot)perillo(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [RFC] ideas for a new Python DBAPI driver (was Re: libpq test suite)
Date: 2013-02-14 19:42:40
Message-ID: 511D3E30.1020102@joh.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 14/02/2013 20:01, Peter Eisentraut wrote:
> On 2/14/13 9:23 AM, Manlio Perillo wrote:
>> 1) always use PQsendQueryParams functions.
>>
>> This will avoid having to escape parameters, as it is done in
>> psycopg2
>> (IMHO it still use simple query protocol for compatibility purpose)
>
> I think the reason this doesn't work is that in order to prepare a query
> you need to know the parameter types, but you don't know that in Python,
> or at least with the way the DB-API works. For example, if you write
>
> cur.execute("SELECT * FROM tbl WHERE a = %s AND b = %s", (val1, val2))
>
> what types will you pass to PQsendQueryParams?

Pardon me if this is obvious, but why would you need to pass any types
at all? Assuming we're still talking about PQsendQueryParams and not an
explicit prepare/execute cycle..

Regards,
Marko Tiikkaja

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2013-02-14 19:43:21 Re: PATCH: Split stats file per database WAS: autovacuum stress-testing our system
Previous Message Manlio Perillo 2013-02-14 19:31:43 Re: [RFC] ideas for a new Python DBAPI driver (was Re: libpq test suite)