Ok, I'm dating my work with this question about a library I haven't coded in many years... I have code that has been in production since the late 1990s written in Visual Studio 6.0 C++ using Roguewave's DBTools++.
Suddenly, for a particular case, a query is failing and the RWDBStatus indicates error code 9, message is [ENDOFFETCH} End of Fetch. When I try to run the queries below with the appropriate keys, I get this odd error. Note - I will also be changing the code to be more specific about which query is failing, although it seems to be the second query that fails, as it only gets executed if the first query returned a value...
So, my question then is - does anyone know what "end of fetch" even means in this context? It is not currently cluing me into where to look for this one... Here is the error message, the code is below...
06/04/2014 16:00:40 FindSignature() - failed to execute!
06/04/2014 16:00:40 ErrorCode = 9,ErrorMsg = [ENDOFFETCH] End of Fetch
06/04/2014 16:00:40 VendCode1 = 0,VendCode2 = 0
06/04/2014 16:00:40 VendMsg1 = ,VendMsg2 =
Here is my code:
bool result = false;
RWDBTable tblRMSUsers = m_RMSDatabase.table( "RMSUsers" );
RWDBSelector selRecord = m_RMSDatabase.selector();
selRecord << tblRMSUsers["ExternalKey"];
selRecord.where( tblRMSUsers["InternalKey"] == lLinkToUser );
RWDBReader rdrRecord = selRecord.reader(theConnection);
if( rdrRecord() )
{
RWCString s;
rdrRecord >> s;
// Changed to use view_SwitchUsers2 which includes deleted / inactive users...
RWDBTable tblSwitchUsers = m_RMSDatabase.table( "view_SwitchUsers2" );
RWDBSelector selRecord = m_RMSDatabase.selector();
selRecord << tblSwitchUsers ["Signature"];
selRecord.where( tblSwitchUsers ["SID"] == s );
RWDBReader rdrRecord1 = selRecord.reader(theConnection);
if(rdrRecord1 ())
{
rdrRecord1 >> blob;
result = true;
}
else
{
RWDBStatus theStatus = rdrRecord1.status();
TraceStr("FindSignature() - failed to execute!");
TraceStr("ErrorCode = %d,ErrorMsg = %s ", theStatus.errorCode(), theStatus.message() );
TraceStr("VendCode1 = %d,VendCode2 = %d ", theStatus.vendorError1(), theStatus.vendorError2() );
TraceStr("VendMsg1 = %s,VendMsg2 = %s ", theStatus.vendorMessage1(), theStatus.vendorMessage2() );
return false;
}
}
Any insights are appreciated!
End of fetch is set as the status when there are no more results to read from the database.
Are you sure your query is not returning an empty result set?