Re: deallocating prepared statements

"Daniel Verite" <[email protected]> Wed, 03 Dec 2008 12:29:05 +0100
Newsgroups gmane.comp.db.postgresql.interfaces
Message-ID <c8f91968-0e45-469e-8632-8f36fec41c06@mm>
	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

-- 
Sent via pgsql-interfaces mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-interfaces