Thread: Getting Recordset through returning refcursor

Getting Recordset through returning refcursor

From
"Kubilay Kaan"
Date:
Hello friends,
 
hopefully I am right here bcz its my first post so..
 
I am using the Provider=MSDASQL.1 through psqlODBC as Data Source(created user DSN).
Postgresversion is 12.
Programming language is C++.
OS = Windows 10.
 
So my problem is when I call a sql function which returns a refcursor for dynamic sql purposes it doesnt fill the
recordset.
 
So my question is does the ODBC driver supports refcursor??
 
Is there any example/codesnippet or any sugestions? I did search alot abt this topic without success.

I did try it as -> spRecordset = spCommand->Execute(NULL, NULL, 0);

as well as spREFRecordset->Open(_T("select GetRecordSetByID_ref('refcur', 1); FETCH ALL IN \"refcur\";"),
spConnection.GetInterfacePtr(),adOpenForwardOnly, adLockOptimistic, adCmdText); 

I always get an empty recordset
 
 
Thx in advance..



Re: Getting Recordset through returning refcursor

From
Clemens Ladisch
Date:
Kubilay Kaan wrote:
> So my question is does the ODBC driver supports refcursor??

The ODBC driver just transmits all SQL commands to the database.

As far as I know, the refcursor type is not available in SQL, only in PL/pgSQL,
which can be used only inside functions.

> "select GetRecordSetByID_ref('refcur', 1); FETCH ALL IN \"refcur\";"

Do these commands work when executed in psql?


Regards,
Clemens