Re: PQexecParams and CURSOR - Mailing list pgsql-general

From Michael Fuhr
Subject Re: PQexecParams and CURSOR
Date
Msg-id 20050117152905.GA52887@winnie.fuhr.org
Whole thread Raw
In response to Re: PQexecParams and CURSOR  ("Laurent Marzullo" <laurent.marzullo@atosorigin.com>)
Responses Re: PQexecParams and CURSOR
List pgsql-general
On Mon, Jan 17, 2005 at 11:28:57AM +0100, Laurent Marzullo wrote:

>         // res = PQexec( conn , "FETCH 1 FROM MY_CURSOR" );

The above should work if you uncomment it and comment out or remove
the other two attempts to execute FETCH.

>         /*
>         res = PQexecParams(conn,
>                 "FETCH 1 FROM MY_CURSOR",
>                 0,
>                 NULL,
>                 NULL,
>                 NULL,
>                 NULL,
>                 0);
>         */

The above should also work if you uncomment it and comment out or
remove the other two.

>         res = PQexecParams(conn,
>                 "FETCH 1 FROM MY_CURSOR",
>                 1,
>                 NULL,
>                 paramValues,
>                 NULL,
>                 NULL,
>                 0);

This call fails because you're passing a parameter that the FETCH
statement doesn't need (you're passing 1 as the nParams argument
and the parameter list as paramValues).  Use one of the other two
methods, either PQexec() or PQexecParams() with nParams set to 0
and pass NULL instead of paramValues.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

pgsql-general by date:

Previous
From: "Mike G."
Date:
Subject: Use strict with plperl
Next
From: Bo Lorentsen
Date:
Subject: Re: Index optimization ?