Re: PQexecParams and CURSOR

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Laurent Marzullo <laurent(dot)marzullo(at)atosorigin(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PQexecParams and CURSOR
Date: 2005-01-17 15:29:05
Message-ID: 20050117152905.GA52887@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bo Lorentsen 2005-01-17 15:30:06 Re: Index optimization ?
Previous Message Mike G. 2005-01-17 15:25:37 Use strict with plperl