#include "TDbiBinaryFile.hxx"
#include "TDbiResultKey.hxx"
#include "TDbiResultSetNonAgg.hxx"
#include "TDbiInRowStream.hxx"
#include "TDbiTableRow.hxx"
#include "TDbiTimerManager.hxx"
#include <TSK_DBI_Log.hxx>
#include <MsgFormat.h>
Go to the source code of this file.
Functions | |
ClassImp (TDbiResultSetNonAgg) TDbiResultSetNonAgg |
ClassImp | ( | TDbiResultSetNonAgg | ) |
Purpose: Default constructor Arguments: resultSet in/out Pointer TDbiInRowStream from query. May be null. tableRow in Pointer to a sample tableRow object. May be null. vrec in Pointer to validity record from query. May be null dropSeqNo in If = kTRUE, drop SeqNo if it is the first col. sqlQualifier in Extended Context sql qualifiers Return: n/a Contact: N. West Specification:- ============= o Create Result from TDbiInRowStream generated by query. If first column is named SeqNo then strip it off before filling each TDbiTableRow and quit as soon as the SeqNo changes. Program Notes:- ============= o tableRow is just used to create new subclass TDbiTableRow objects. o The special treatment for tables that start with SeqNo allow a single TDbiInRowStream to fill multiple TDbiResultSet objects but does require that the result set is ordered by SeqNo. The look-up table is not built by default, its construction is triggered by use (GetTableRowByIndex). For TDbiResultSetNonAgg that are part of a TDbiResultSetAgg there is no need to build the table.
Definition at line 13 of file TDbiResultSetNonAgg.cxx.
References TDbiRowStream::CurColName(), TDbiRowStream::DecrementCurCol(), TDbiInRowStream::FetchRow(), TDbiTableRow::Fill(), TDbiTimerManager::gTimerManager, TDbiRowStream::IncrementCurCol(), TDbiInRowStream::IsBeforeFirst(), TDbiInRowStream::IsExhausted(), TDbiRowStream::IsVLDTable(), TDbiTimerManager::RecFillAgg(), TDbiTableRow::SetOwner(), SK_DBI_Info, and TDbiTimerManager::StartSubWatch().
00023 : ctors, dtor, operators then in alphabetical order. 00024 00025 // 00026 //..................................................................... 00027 ///\verbatim 00028 /// Purpose: Default constructor 00029 /// 00030 /// Arguments: 00031 /// resultSet in/out Pointer TDbiInRowStream from query. May be null. 00032 /// tableRow in Pointer to a sample tableRow object. 00033 /// May be null. 00034 /// vrec in Pointer to validity record from query. 00035 /// May be null 00036 /// dropSeqNo in If = kTRUE, drop SeqNo if it is the first col. 00037 /// sqlQualifier in Extended Context sql qualifiers 00038 /// 00039 /// Return: n/a 00040 /// 00041 /// Contact: N. West 00042 /// 00043 /// Specification:- 00044 /// ============= 00045 /// 00046 /// o Create Result from TDbiInRowStream generated by query. If first 00047 /// column is named SeqNo then strip it off before filling each 00048 /// TDbiTableRow and quit as soon as the SeqNo changes. 00049 /// 00050 /// 00051 /// Program Notes:- 00052 /// ============= 00053 /// 00054 /// o tableRow is just used to create new subclass TDbiTableRow objects. 00055 /// 00056 /// o The special treatment for tables that start with SeqNo allow 00057 /// a single TDbiInRowStream to fill multiple TDbiResultSet objects but does 00058 /// require that the result set is ordered by SeqNo. 00059 /// 00060 /// The look-up table is not built by default, its construction is 00061 /// triggered by use (GetTableRowByIndex). For TDbiResultSetNonAgg 00062 /// that are part of a TDbiResultSetAgg there is no need to build the 00063 /// table. 00064 ///\endverbatim 00065 00066 TDbiResultSetNonAgg::TDbiResultSetNonAgg(TDbiInRowStream* resultSet, 00067 const TDbiTableRow* tableRow, 00068 const TDbiValidityRec* vrec, 00069 Bool_t dropSeqNo, 00070 const string& sqlQualifiers) : 00071 TDbiResultSet(resultSet,vrec,sqlQualifiers), 00072 fBuffer(0) 00073 { 00074 00075 this->DebugCtor(); 00076 00077 if ( ! resultSet || resultSet->IsExhausted() || ! tableRow ) return; 00078 00079 if ( vrec ) TDbiTimerManager::gTimerManager.RecFillAgg(vrec->GetAggregateNo()); 00080 00081 //Move to first row if result set not yet started. 00082 TDbiInRowStream& rs = *resultSet; 00083 if ( rs.IsBeforeFirst() ) rs.FetchRow(); 00084 if ( rs.IsExhausted() ) return; 00085 00086 //Check and load sequence number if necessary. 00087 Int_t seqNo = 0; 00088 if ( dropSeqNo && rs.CurColName() == "SEQNO" ) { 00089 rs >> seqNo; 00090 rs.DecrementCurCol(); 00091 } 00092 00093 // Main (non-VLD) tables have a ROW_COUNTER (which has to be ignored when reading). 00094 bool hasRowCounter = ! rs.IsVLDTable(); 00095 00096 // Create and fill table row object and move result set onto next row. 00097 00098 while ( ! rs.IsExhausted() ) { 00099 00100 // If stripping off sequence numbers check the next and quit, 00101 // having restored the last, if it changes. 00102 if ( seqNo != 0 ) { 00103 Int_t nextSeqNo; 00104 rs >> nextSeqNo; 00105 if ( nextSeqNo != seqNo ) { 00106 rs.DecrementCurCol(); 00107 break; 00108 } 00109 } 00110 00111 // Strip off ROW_COUNTER if present. 00112 if ( hasRowCounter ) rs.IncrementCurCol(); 00113 TDbiTableRow* row = tableRow->CreateTableRow(); 00114 if ( vrec) TDbiTimerManager::gTimerManager.StartSubWatch(3); 00115 row->SetOwner(this); 00116 row->Fill(rs,vrec); 00117 if ( vrec) TDbiTimerManager::gTimerManager.StartSubWatch(2); 00118 fRows.push_back(row); 00119 rs.FetchRow(); 00120 if ( vrec) TDbiTimerManager::gTimerManager.StartSubWatch(1); 00121 } 00122 00123 //Flag that data was read from Database. 00124 this->SetResultsFromDb(); 00125 if ( seqNo == 0 ) 00126 SK_DBI_Info( "Created unaggregated VLD result set no. of rows: " 00127 << this->GetNumRows() << " "); 00128 else SK_DBI_Info( "Created unaggregated result set for SeqNo: " << seqNo 00129 << " no. of rows: " << this->GetNumRows() << " "); 00130 00131 }