Re: deallocating prepared statements - Mailing list pgsql-interfaces

From Daniel Verite
Subject Re: deallocating prepared statements
Date
Msg-id c8f91968-0e45-469e-8632-8f36fec41c06@mm
Whole thread Raw
In response to deallocating prepared statements  ("Haszlakiewicz, Eric" <EHASZLA@transunion.com>)
Responses Re: deallocating prepared statements
List 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,
-- DanielPostgreSQL-powered mail user agent and storage: 
http://www.manitou-mail.org


pgsql-interfaces by date:

Previous
From: "Haszlakiewicz, Eric"
Date:
Subject: deallocating prepared statements
Next
From: Michael Meskes
Date:
Subject: Re: deallocating prepared statements