size_t CDBL_CursorResult::ReadItem(void* buffer, size_t buffer_size, bool* is_null) { if (GetResultSet()) { return GetResultSet()->ReadItem(buffer, buffer_size, is_null); } if (is_null) *is_null = true; return 0; }
bool CDBL_CursorResult::Fetch() { if ( !GetResultSet() ) return false; try { if (GetResultSet()->Fetch()) return true; } catch (CDB_ClientEx& ex) { if (ex.GetDBErrCode() == 200003) { // ClearResultSet(); m_Res = NULL; } else { DATABASE_DRIVER_ERROR( "Failed to fetch the results." + GetDbgInfo(), 222011 ); } } // try to get next cursor result try { // finish this command // ClearResultSet(); if ( m_Res ) { delete m_Res; m_Res = NULL; } while (m_Cmd->HasMoreResults()) { DumpResultSet(); } // send the another "fetch cursor_name" command m_Cmd->Send(); while (m_Cmd->HasMoreResults()) { SetResultSet( m_Cmd->Result() ); if (GetResultSet() && GetResultSet()->ResultType() == eDB_RowResult) { return GetResultSet()->Fetch(); } FetchAllResultSet(); } } catch ( const CDB_Exception& e ) { DATABASE_DRIVER_ERROR_EX( e, "Failed to fetch the results." + GetDbgInfo(), 222011 ); } return false; }
bool CResultSetManager::DeleteResultSet(ResultSetId_t id) { if (IsValidResultSet(id) == false) return false; if (GetResultSet(id) == GetActiveResultSet()) SetActiveResultSet(nullptr); return m_StoredResults.erase(id) == 1; }
IResultSet* CStatement::ExecuteQuery(const string& sql) { SendSql(sql); while ( HasMoreResults() ) { if ( HasRows() ) { return GetResultSet(); } } return 0; }
CDBL_CursorResult::CDBL_CursorResult(CDBL_Connection& conn, CDB_LangCmd* cmd) : CDBL_Result(conn, NULL), m_Cmd(cmd), m_Res(0) { try { GetCmd().Send(); while (GetCmd().HasMoreResults()) { SetResultSet( GetCmd().Result() ); if (GetResultSet() && GetResultSet()->ResultType() == eDB_RowResult) { return; } if ( GetResultSet() ) { while (GetResultSet()->Fetch()) continue; ClearResultSet(); } } } catch ( const CDB_Exception& e ) { DATABASE_DRIVER_ERROR_EX( e, "Failed to get the results." + GetDbgInfo(), 222010 ); } }
void CStatement::PurgeResults() { while (HasMoreResults()) { if (HasRows()) { auto_ptr<IResultSet> rs( GetResultSet() ); if (rs.get()) { // Is it necessary??? while (rs->Next()) { ; } } } } }
bool CDBL_CursorResult::SkipItem() { return GetResultSet() ? GetResultSet()->SkipItem() : false; }
I_ITDescriptor* CDBL_CursorResult::GetImageOrTextDescriptor() { return GetResultSet() ? GetResultSet()->GetImageOrTextDescriptor() : 0; }
CDB_Object* CDBL_CursorResult::GetItem(CDB_Object* item_buff, I_Result::EGetItem policy) { return GetResultSet() ? GetResultSet()->GetItem(item_buff, policy) : 0; }
int CDBL_CursorResult::GetColumnNum(void) const { return GetResultSet() ? GetResultSet()->GetColumnNum() : -1; }
int CDBL_CursorResult::CurrentItemNo() const { return GetResultSet() ? GetResultSet()->CurrentItemNo() : -1; }