Re: deallocating prepared statements

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: deallocating prepared statements
Date: 2008-12-03 11:29:05
Message-ID: c8f91968-0e45-469e-8632-8f36fec41c06@mm
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Haszlakiewicz, Eric wrote:

> So, instead I tried using the libpq interface:
>
> struct connection *ecpg_conn = ECPGget_connection(NULL);
> PGconn *conn = ecpg_conn->connection;
> Oid deallocTypes[] = { VARCHAROID };
> const char *deallocValues[] = { stmtName };
> int deallocLengths[] = { strlen(stmtName) } ;
> int deallocFormats[] = { 0 } ;
>
> PGresult *dealloc_result;
> dealloc_result = PQexecParams(conn, "DEALLOCATE $1", 1, deallocTypes,
> deallocValues, deallocLengths, deallocFormats, 1);
>
> But I get this error:
> syntax error at or near "$1" at character 12

The prepared statement's name is not a literal, and in general
parameterized queries don't accept parameters beyond literals. So you
need to insert the name directly into the SQL command text.

Best regards,
--
Daniel
PostgreSQL-powered mail user agent and storage:
http://www.manitou-mail.org

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Michael Meskes 2008-12-03 14:12:55 Re: deallocating prepared statements
Previous Message Haszlakiewicz, Eric 2008-12-02 19:22:46 deallocating prepared statements