Re: Prepared statements aren't working with parameters with PQexecParams

From: "David Wilson" <david(dot)t(dot)wilson(at)gmail(dot)com>
To: "Subspace god" <subspacegod(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Prepared statements aren't working with parameters with PQexecParams
Date: 2008-09-05 07:19:12
Message-ID: e7f9235d0809050019r1925d83ah5184809ffcd59107@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Sep 5, 2008 at 2:52 AM, Subspace god <subspacegod(at)gmail(dot)com> wrote:

> The following does not work in C++, executed as above, in another session
> using two subsequent calls to PQexecParams
>
> PREPARE myquery (text) AS INSERT INTO myTable (word) VALUES ($1);
> EXECUTE myquery($1::text);

You're doing prepared statements incorrectly. Use PQprepare() and
PQexecPrepared() when using them from libpq; don't do them by hand on
your own.

--
- David T. Wilson
david(dot)t(dot)wilson(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ow Mun Heng 2008-09-05 08:03:13 max_stack_depth Exceeded
Previous Message Maxim Boguk 2008-09-05 07:13:08 Re: Postgresql optimisator deoptimise queries sometime...