|
I have tried using SQLGetDiagField as well and have not had any
success using it either. It is returning a SQLRETURN value of 0 and a
vRowCount value of 0. After the call the pointer pRowCount is also
changed to *NULL. The result set contains at least a billion rows and
I have tested with smaller result sets resulting in the same issue.
Please see the code below.
Any thoughts would be greatly appreciated.
*-----------------------------------------------------------------
* Procedure name: SQLCLI_getResultRowCount
* Purpose: Get the Result Set Row Count
* Returns: Returned Result Set Row Count
* Parameter: piStmtHandle => Statement Handle
*-----------------------------------------------------------------
p SQLCLI_getResultRowCount...
p b export
d SQLCLI_getResultRowCount...
d pi 10i 0
d piStmtHandle 10i 0
d* piConnHandle 10i 0
* Local definitions
d pRowCount s * inz
d vBLen s 5i 0 inz
d vRecNum s like(SQLSMALLINT) inz(0)
d vRowCount s 10i 0 inz
d vSLen s 5i 0 inz
d vSQLRC s 10i 0 inz
d vStmtHandle s like(SQLINTEGER) inz
/free
vStmtHandle = piStmtHandle;
pRowCount = %addr(vRowCount);
vBLen = %len(vRowCount);
vSLen = 0;
vSQLRC = SQL_GetDiagField(SQL_HANDLE_STMT :vStmtHandle
:vRecNum :SQL_DIAG_ROW_COUNT
:pRowCount :vBLen :vSLen);
if vSQLRC<> 0;
@ErrorDs = SQLError(vStmtHandle);
endif;
return vRowCount;
//----------------------------------------------------------------------
// Subprocedure error handling routine
//----------------------------------------------------------------------
begsr *pssr;
dump(a) 'SubProc(SQLCLI_getResultRowCount)';
vRowCount = -1;
return vRowCount;
endsr;
/end-free
p SQLCLI_getResultRowCount...
p e
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.