deallocating prepared statements - Mailing list pgsql-interfaces

From Haszlakiewicz, Eric
Subject deallocating prepared statements
Date
Msg-id 9D29FD18CBD74A478CBA86E6EF6DBAD402FF8CC9@CHI4EVS04.corp.transunion.com
Whole thread Raw
Responses Re: deallocating prepared statements  ("Daniel Verite" <daniel@manitou-mail.org>)
Re: deallocating prepared statements  (Michael Meskes <meskes@postgresql.org>)
List pgsql-interfaces
I've been having some trouble trying to use the libpq api.  Among other
problems (such as '?' style query parameters not working), I can't
figure out how to deallocate prepared statements.  I tried using esql to
do it (since the docs say that "it is only for use in embedded sql"):

exec sql begin declare section;   const char *stmtName = "exec_stmt";
exec sql end declare section;
exec sql deallocate :stmtName;

but that didn't do anything useful.  Doing a subsequent PQprepare call
still complained that the statement was still present.

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

What am I doing wrong?

eric


pgsql-interfaces by date:

Previous
From: "Sean Davis"
Date:
Subject: JDBC and copy support
Next
From: "Daniel Verite"
Date:
Subject: Re: deallocating prepared statements