Hello,
I Could not achieve to use CURSOR with PQexecParams ! How to you do ?
Here what I've done:
1)------------------------------------
paramValues[0] = "2"; // This is the parameter for the query
res = PQexec( conn , "DECLARE MY_CURSOR FOR "
"SELECT * FROM GRGL.RANGE_MODIFIER "
"WHERE WEAPON_ID = $1" );
=> ERROR
DECLARE failed: ERROR: There is no parameter 1
2)------------------------------------
then
paramValues[0] = "2"; // This is the parameter for the query
res = PQexecParams( conn ,
"DECLARE MY_CURSOR FOR "
"SELECT * FROM GRGL.RANGE_MODIFIER "
"WHERE WEAPON_ID = $1",
1,
NULL,
paramValues,
NULL,
NULL,
0);
res = PQexec( conn , "FETCH 1 FROM MY_CURSOR" );
=> Error
FETCH failed: ERROR: no value found for parameter 1
3)--------------------------------------
then
paramValues[0] = "2"; // This is the parameter for the query
res = PQexecParams( conn ,
"DECLARE MY_CURSOR FOR "
"SELECT * FROM GRGL.RANGE_MODIFIER "
"WHERE WEAPON_ID = $1" ,
1,
NULL,
paramValues,
NULL,
NULL,
0); );
res = PQexecParams( conn ,
"FETCH 1 FROM MY_CURSOR",
1,
NULL,
paramValues,
NULL,
NULL,
0);
=> Error:
FETCH failed: ERROR: bind message supplies 1 parameters, but prepared
statement "" requires 0
PLEASE, COULD YOU HELP ? THANKS.
Laurent Marzullo