From: | "Haszlakiewicz, Eric" <EHASZLA(at)transunion(dot)com> |
---|---|
To: | <pgsql-interfaces(at)postgresql(dot)org> |
Subject: | deallocating prepared statements |
Date: | 2008-12-02 19:22:46 |
Message-ID: | 9D29FD18CBD74A478CBA86E6EF6DBAD402FF8CC9@CHI4EVS04.corp.transunion.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Verite | 2008-12-03 11:29:05 | Re: deallocating prepared statements |
Previous Message | Sean Davis | 2008-11-05 18:07:11 | JDBC and copy support |