pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Verite <daniel@manitou-mail.org>
To: pgsql-interfaces@postgresql.org
Subject: Re: deallocating prepared statements
Date: Wed, 03 Dec 2008 12:29:05 +0100
Message-ID: <c8f91968-0e45-469e-8632-8f36fec41c06@mm> (raw)
In-Reply-To: <9D29FD18CBD74A478CBA86E6EF6DBAD402FF8CC9@CHI4EVS04.corp.transunion.com>

	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,
-- 
 Daniel
 PostgreSQL-powered mail user agent and storage: 
http://www.manitou-mail.org



view thread (8+ messages)  latest in thread

Message-ID: <c8f91968-0e45-469e-8632-8f36fec41c06@mm>
Permalink:  ../c8f91968-0e45-469e-8632-8f36fec41c06@mm/
Also on:    postgresql.org/message-id/c8f91968-0e45-469e-8632-8f36fec41c06@mm

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: daniel@manitou-mail.org
  Subject: Re: deallocating prepared statements
  In-Reply-To: <c8f91968-0e45-469e-8632-8f36fec41c06@mm>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox