DbiOutRowStream Class Reference

#include <DbiOutRowStream.h>

Inheritance diagram for DbiOutRowStream:
DbiRowStream

List of all members.

Public Member Functions

 DbiOutRowStream (const DbiTableMetaData *metaData)
virtual ~DbiOutRowStream ()
Bool_t HasGoodData () const
const string & GetCSV () const
Bool_t IsComplete () const
DbiOutRowStreamoperator<< (Bool_t src)
DbiOutRowStreamoperator<< (Char_t src)
DbiOutRowStreamoperator<< (const Char_t *src)
DbiOutRowStreamoperator<< (Short_t src)
DbiOutRowStreamoperator<< (UShort_t src)
DbiOutRowStreamoperator<< (Int_t src)
DbiOutRowStreamoperator<< (UInt_t src)
DbiOutRowStreamoperator<< (Float_t src)
DbiOutRowStreamoperator<< (Double_t src)
DbiOutRowStreamoperator<< (const string &src)
DbiOutRowStreamoperator<< (const VldTimeStamp &src)
void Clear ()

Private Member Functions

void Store (const string &str)
Bool_t StoreDefaultIfInvalid (Dbi::DataTypes type)

Private Attributes

Bool_t fBadData
 Set KTRUE if streamed bad data.
string fCSV
 Comma separated list of values.

Friends

class DbiConfigSet

Detailed Description

Id
DbiOutRowStream.h,v 1.11 2006/08/08 10:51:32 west Exp

Definition at line 35 of file DbiOutRowStream.h.


Constructor & Destructor Documentation

DbiOutRowStream::DbiOutRowStream ( const DbiTableMetaData metaData  ) 

Definition at line 52 of file DbiOutRowStream.cxx.

References Msg::kVerbose, LEA_CTOR, and MSG.

00052                                                                  :
00053 DbiRowStream(metaData),
00054 fBadData(kFALSE)
00055 {
00056 //
00057 //
00058 //  Purpose:  Default constructor
00059 //
00060 //  Arguments:
00061 //     metaData in  Meta data for table to be written to..
00062 
00063   LEA_CTOR    //Leak Checker
00064 
00065   MSG("Dbi", Msg::kVerbose) << "Creating DbiOutRowStream" << endl;
00066 
00067 }

DbiOutRowStream::~DbiOutRowStream (  )  [virtual]

Definition at line 72 of file DbiOutRowStream.cxx.

References Msg::kVerbose, LEA_DTOR, and MSG.

00072                                   {
00073 //
00074 //
00075 //  Purpose: Destructor
00076 
00077   LEA_DTOR    //Leak Checker
00078 
00079   MSG("Dbi", Msg::kVerbose) << "Destroying DbiOutRowStream" << endl;
00080 
00081 }


Member Function Documentation

void DbiOutRowStream::Clear (  )  [inline]

Definition at line 67 of file DbiOutRowStream.h.

References DbiRowStream::ClearCurCol(), fBadData, and fCSV.

00067 { fBadData = kFALSE; fCSV.erase(); ClearCurCol();}

const string& DbiOutRowStream::GetCSV (  )  const [inline]

Definition at line 48 of file DbiOutRowStream.h.

References fCSV.

Referenced by DbiSqlValPacket::AddRow(), and DbiSqlValPacket::Recreate().

00048 { return fCSV; }

Bool_t DbiOutRowStream::HasGoodData (  )  const [inline]

Definition at line 47 of file DbiOutRowStream.h.

References fBadData, and IsComplete().

Referenced by DbiSqlValPacket::AddRow().

00047 { return ! fBadData && IsComplete(); }

Bool_t DbiOutRowStream::IsComplete (  )  const [inline]

Definition at line 49 of file DbiOutRowStream.h.

References DbiRowStream::CurColNum(), and DbiRowStream::NumCols().

Referenced by DbiSqlValPacket::AddRow(), and HasGoodData().

00049 { return CurColNum() == NumCols()+1; }

DbiOutRowStream & DbiOutRowStream::operator<< ( const VldTimeStamp src  ) 

Definition at line 115 of file DbiOutRowStream.cxx.

References Dbi::kDate, Dbi::MakeDateTimeString(), Store(), and StoreDefaultIfInvalid().

00115                                                                     {
00116   if ( ! StoreDefaultIfInvalid(Dbi::kDate) )
00117                           Store(Dbi::MakeDateTimeString(src).c_str());
00118   return *this;
00119 }

DbiOutRowStream & DbiOutRowStream::operator<< ( const string &  src  ) 

Definition at line 112 of file DbiOutRowStream.cxx.

References Dbi::kString, and OUT.

00112                                                               {
00113                                     OUT(Dbi::kString,src); return *this;}

DbiOutRowStream & DbiOutRowStream::operator<< ( Double_t  src  ) 

Definition at line 109 of file DbiOutRowStream.cxx.

References Dbi::kDouble, and OUT.

00109                                                          {
00110                                      OUT(Dbi::kDouble,src);  return *this;}

DbiOutRowStream & DbiOutRowStream::operator<< ( Float_t  src  ) 

Definition at line 106 of file DbiOutRowStream.cxx.

References Dbi::kFloat, and OUT.

00106                                                         {
00107                                      OUT(Dbi::kFloat,src); return *this;}

DbiOutRowStream & DbiOutRowStream::operator<< ( UInt_t  src  ) 

Definition at line 103 of file DbiOutRowStream.cxx.

References Dbi::kUInt, and OUT2.

00103                                                        {
00104                                      OUT2(Dbi::kUInt,src);  return *this;}

DbiOutRowStream & DbiOutRowStream::operator<< ( Int_t  src  ) 

Definition at line 100 of file DbiOutRowStream.cxx.

References Dbi::kInt, and OUT.

00100                                                       {
00101                                      OUT(Dbi::kInt,src);  return *this;}

DbiOutRowStream & DbiOutRowStream::operator<< ( UShort_t  src  ) 

Definition at line 97 of file DbiOutRowStream.cxx.

References Dbi::kUShort, and OUT2.

00097                                                          {
00098                                      OUT2(Dbi::kUShort,src); return *this;}

DbiOutRowStream & DbiOutRowStream::operator<< ( Short_t  src  ) 

Definition at line 94 of file DbiOutRowStream.cxx.

References Dbi::kShort, and OUT.

00094                                                         {
00095                                      OUT(Dbi::kShort,src);  return *this;}

DbiOutRowStream & DbiOutRowStream::operator<< ( const Char_t *  src  ) 

Definition at line 91 of file DbiOutRowStream.cxx.

References Dbi::kString, and OUT.

00091                                                               {
00092                                      OUT(Dbi::kString,src);  return *this;}

DbiOutRowStream & DbiOutRowStream::operator<< ( Char_t  src  ) 

Definition at line 88 of file DbiOutRowStream.cxx.

References Dbi::kChar, and OUT.

00088                                                        {
00089                                      OUT(Dbi::kChar,src);  return *this;}

DbiOutRowStream & DbiOutRowStream::operator<< ( Bool_t  src  ) 

Definition at line 85 of file DbiOutRowStream.cxx.

References Dbi::kBool, and OUT.

00085                                                        {
00086                                      OUT(Dbi::kBool,src);  return *this;}

void DbiOutRowStream::Store ( const string &  str  )  [private]

Definition at line 170 of file DbiOutRowStream.cxx.

References DbiRowStream::CurColFieldType(), DbiRowStream::CurColNum(), fCSV, DbiFieldType::GetConcept(), DbiRowStream::IncrementCurCol(), Dbi::kChar, Dbi::kDate, Dbi::kString, and UtilString::MakePrintable().

Referenced by operator<<(), DbiConfigSet::Store(), and StoreDefaultIfInvalid().

00170                                               {
00171 //
00172 //
00173 //  Purpose: Store string value as comma separated values but exclude SeqNo.  
00174 //
00175 //  Arguments: 
00176 //    str          in    Value to be stored.
00177 //
00178 //  Return:    
00179 //
00180 //  Contact:   N. West
00181 //
00182 //  Specification:-
00183 //  =============
00184 //
00185 //  o Store string value in CSV with separator from 
00186 //    previous value and increment fNumValues.  If required
00187 //    enclose value in quotes. If storing the SeqNo column then
00188 //    store a single '?' instead which will be replace during
00189 //    SQL generation - see 
00190 
00191 //  Program Notes:-
00192 //  =============
00193 
00194 //  None.
00195 
00196   UInt_t concept = CurColFieldType().GetConcept();
00197   string delim = "";
00198   if (    concept == Dbi::kString 
00199        || concept == Dbi::kDate 
00200        || concept == Dbi::kChar ) delim = "\'";  
00201 
00202   if ( CurColNum()> 1 ) fCSV += ',';
00203   fCSV += delim;
00204   if ( concept != Dbi::kString ) fCSV += str;
00205 //  When exporting strings, take care of special characters.
00206   else {
00207     UtilString::MakePrintable(str.c_str(),fCSV);
00208   }
00209   fCSV += delim;
00210   IncrementCurCol();
00211 }

Bool_t DbiOutRowStream::StoreDefaultIfInvalid ( Dbi::DataTypes  type  )  [private]

Definition at line 126 of file DbiOutRowStream.cxx.

References DbiFieldType::AsString(), DbiRowStream::CurColFieldType(), DbiRowStream::CurColName(), DbiRowStream::CurColNum(), fBadData, DbiFieldType::IsCompatible(), Msg::kError, MAXMSG, Store(), DbiRowStream::TableNameTc(), and DbiFieldType::UndefinedValue().

Referenced by operator<<().

00126                                                                {
00127 //
00128 //
00129 //  Purpose:  Store default value if illegal type supplied.
00130 //
00131 //  Arguments: 
00132 //    type         in    Type of supplied value.
00133 //
00134 //  Return:    kTRUE if illegal type supplied.
00135 //
00136 //  Contact:   N. West
00137 //
00138 //  Specification:-
00139 //  =============
00140 //
00141 //  o If type of supplied value is incompatible with current column
00142 //    type store default value, report error and return kTRUE, otherwise
00143 //    return kFALSE.
00144 
00145 //  Program Notes:-
00146 //  =============
00147 
00148 //  None.
00149 
00150   DbiFieldType typeSupplied(type);
00151   DbiFieldType typeRequired(CurColFieldType());
00152   if ( typeSupplied.IsCompatible(typeRequired) ) return kFALSE;
00153 
00154   string udef = typeRequired.UndefinedValue();
00155   MAXMSG("Dbi",Msg::kError,20) 
00156       << "In table " << TableNameTc() 
00157       << " column "<< CurColNum() 
00158       << " (" << CurColName() << ")"
00159       << " of type " << typeRequired.AsString()
00160       << " is incompatible with user type " << typeSupplied.AsString()
00161       << ", value \"" << udef
00162       << "\" will be substituted." <<  endl;
00163   Store(udef.c_str());
00164   fBadData = kTRUE;
00165   return kTRUE; 
00166 
00167 }


Friends And Related Function Documentation

friend class DbiConfigSet [friend]

Definition at line 38 of file DbiOutRowStream.h.


Member Data Documentation

Bool_t DbiOutRowStream::fBadData [private]

Set KTRUE if streamed bad data.

Definition at line 80 of file DbiOutRowStream.h.

Referenced by Clear(), HasGoodData(), and StoreDefaultIfInvalid().

string DbiOutRowStream::fCSV [private]

Comma separated list of values.

Definition at line 83 of file DbiOutRowStream.h.

Referenced by Clear(), GetCSV(), and Store().


The documentation for this class was generated from the following files:

Generated on 21 Oct 2017 for loon by  doxygen 1.6.1