Re: deallocating prepared statements

Поиск
Список
Период
Сортировка
От Daniel Verite
Тема Re: deallocating prepared statements
Дата
Msg-id c8f91968-0e45-469e-8632-8f36fec41c06@mm
обсуждение исходный текст
Ответ на deallocating prepared statements  ("Haszlakiewicz, Eric" <EHASZLA@transunion.com>)
Ответы Re: deallocating prepared statements  ("Haszlakiewicz, Eric" <EHASZLA@transunion.com>)
Список pgsql-interfaces
    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,
-- DanielPostgreSQL-powered mail user agent and storage: 
http://www.manitou-mail.org


В списке pgsql-interfaces по дате отправления:

Предыдущее
От: "Haszlakiewicz, Eric"
Дата:
Сообщение: deallocating prepared statements
Следующее
От: Michael Meskes
Дата:
Сообщение: Re: deallocating prepared statements