deallocating prepared statements
"Haszlakiewicz, Eric" <[email protected]> Tue, 2 Dec 2008 13:22:46 -0600
| Newsgroups | gmane.comp.db.postgresql.interfaces |
|---|---|
| Message-ID | <9D29FD18CBD74A478CBA86E6EF6DBAD402FF8CC9@CHI4EVS04.corp.transunion.com> |
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
--
Sent via pgsql-interfaces mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-interfaces