deallocating prepared statements

Поиск
Список
Период
Сортировка
От Haszlakiewicz, Eric
Тема deallocating prepared statements
Дата
Msg-id 9D29FD18CBD74A478CBA86E6EF6DBAD402FF8CC9@CHI4EVS04.corp.transunion.com
обсуждение исходный текст
Ответы Re: deallocating prepared statements  ("Daniel Verite" <daniel@manitou-mail.org>)
Re: deallocating prepared statements  (Michael Meskes <meskes@postgresql.org>)
Список 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 по дате отправления:

Предыдущее
От: "Sean Davis"
Дата:
Сообщение: JDBC and copy support
Следующее
От: "Daniel Verite"
Дата:
Сообщение: Re: deallocating prepared statements