CURSORs and selects with parameters

From: Dan Sugalski <dan(at)sidhe(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: CURSORs and selects with parameters
Date: 2005-02-15 19:32:56
Message-ID: a06210204be37fa6e9f1c@[172.24.18.155]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

When using cursors through the libpq interface, do I need to be
passing in the parameters when I'm FETCHing from them?

I've got some code that uses PQexecParams and does the equivalent of:

DECLARE a_cursor CURSOR FOR SELECT foo, bar FROM baz WHERE field = $1
FETCH NEXT a_cursor

but when I get to the FETCH I'm getting back the error:

ERROR: no value found for parameter 1

which is fair enough, as I'm not *passing* in any parameters to the
fetch. (Yes, I double-checked--the parameter count in the
PQexecParams call is 1 for the cursor declaration, and 0 for the
fetch) Do I have to?
--
Dan

--------------------------------------it's like this-------------------
Dan Sugalski even samurai
dan(at)sidhe(dot)org have teddy bears and even
teddy bears get drunk

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2005-02-15 19:50:57 Re: CURSORs and selects with parameters
Previous Message Christopher Browne 2005-02-15 19:00:20 Re: Slony uninstall info/warning