DbiFieldType Class Reference

#include <DbiFieldType.h>

List of all members.

Public Types

enum  PrecisionLimits {
  kMaxTinyInt = 4, kMaxSmallInt = 6, kMaxInt = 11, kMaxChar = 3,
  kMaxOracleFloat = 32, kMaxMySQLVarchar = 255, kMaxOracleVarchar = 4000, kMaxMySQLText = 65535
}

Public Member Functions

 DbiFieldType (Int_t type=Dbi::kInt)
 DbiFieldType (Int_t type, Int_t size, const char *typeName)
 DbiFieldType (const DbiFieldType &from)
 DbiFieldType (const string &sql, Int_t size)
virtual ~DbiFieldType ()
string AsString () const
string AsSQLString (Dbi::DbTypes dbType=Dbi::kMySQL) const
string UndefinedValue () const
UInt_t GetConcept () const
UInt_t GetSize () const
UInt_t GetType () const
Bool_t IsCompatible (const DbiFieldType &other) const
Bool_t IsEqual (const DbiFieldType &other) const
Bool_t IsSmaller (const DbiFieldType &other) const
Bool_t IsSigned () const
void SetUnsigned ()

Private Member Functions

void Init (Int_t type, Int_t size=-1)

Private Attributes

unsigned int fConcept
 Concept e.g. kInt or kFloat.
unsigned int fSize
 Size in bytes(0 if unknown).
unsigned int fType
 Concept e.g. kShort or kDouble.

Detailed Description

Id
DbiFieldType.h,v 1.16 2007/04/26 14:19:57 west Exp

Definition at line 35 of file DbiFieldType.h.


Member Enumeration Documentation

Enumerator:
kMaxTinyInt 
kMaxSmallInt 
kMaxInt 
kMaxChar 
kMaxOracleFloat 
kMaxMySQLVarchar 
kMaxOracleVarchar 
kMaxMySQLText 

Definition at line 41 of file DbiFieldType.h.

00041                      { kMaxTinyInt       = 4,
00042                        kMaxSmallInt      = 6,
00043                        kMaxInt           = 11,
00044                        kMaxChar          = 3,
00045                        kMaxOracleFloat   = 32,
00046                        kMaxMySQLVarchar  = 255,
00047                        kMaxOracleVarchar = 4000,
00048                        kMaxMySQLText     = 65535
00049 };


Constructor & Destructor Documentation

DbiFieldType::DbiFieldType ( Int_t  type = Dbi::kInt  ) 

Definition at line 36 of file DbiFieldType.cxx.

References LEA_CTOR.

00037 {
00038 //
00039 //
00040 //  Purpose:  Default constructor
00041 //
00042 //  Arguments:   
00043 //    type     in    Data type  (default Dbi::kInt).
00044 
00045 
00046   LEA_CTOR    //Leak Checker
00047 
00048   this->Init(type);
00049 
00050 }

DbiFieldType::DbiFieldType ( Int_t  type,
Int_t  size,
const char *  typeName 
)

Definition at line 53 of file DbiFieldType.cxx.

References Init(), Dbi::kChar, Dbi::kDate, Dbi::kDouble, Msg::kError, Dbi::kFloat, Dbi::kInt, Dbi::kLong, kMaxChar, kMaxInt, kMaxMySQLText, kMaxMySQLVarchar, kMaxSmallInt, kMaxTinyInt, Dbi::kShort, Dbi::kString, Dbi::kTiny, Dbi::kUnknown, LEA_CTOR, and MAXMSG.

00055                                                  {
00056 
00057 
00058 //
00059 //
00060 //  Purpose:  Constructor for TSQL meta-data.
00061 //
00062 //  Arguments:   
00063 //    type      in    value from TSQLColumnInfo::GetSQLType()
00064 //    size      in    value from TSQLColumnInfo::GetLength()
00065 //    typeName  in    value from TSQLColumnInfo::GetTypeName()
00066 
00067   LEA_CTOR    //Leak Checker
00068     
00069   TString name(typeName);
00070   name.ToUpper();
00071 
00072   // Handle integer types.
00073 
00074   if ( type == TSQLServer::kSQL_INTEGER || type == TSQLServer::kSQL_NUMERIC ) {
00075 
00076     // TSQLServer reports e.g. int(32) as size 32, (even though maximum display is 11)
00077     // so treat any type starting int or INT as size kMaxInt (i.e. standard 4 byte int)
00078     if ( name.BeginsWith("INT") ) size = kMaxInt;
00079     if      ( size <= kMaxTinyInt  ) { this->Init(Dbi::kTiny);  return; }
00080     else if ( size <= kMaxSmallInt ) { this->Init(Dbi::kShort); return; }
00081     else if ( size <= kMaxInt      ) { this->Init(Dbi::kInt);   return; }
00082     else                             { this->Init(Dbi::kLong);  return; }
00083 
00084   }
00085 
00086   // Handle floating point types
00087 
00088   if ( type == TSQLServer::kSQL_FLOAT  ) { this->Init(Dbi::kFloat);  return; } 
00089   if ( type == TSQLServer::kSQL_DOUBLE ) { this->Init(Dbi::kDouble);  return; } 
00090 
00091   // Handle cases where type is determined uniquely by type name.
00092 
00093   if ( name == "BINARY_FLOAT" )  { this->Init(Dbi::kFloat);  return; }
00094   if ( name == "BINARY_DOUBLE" ) { this->Init(Dbi::kDouble); return; }
00095   if ( name == "TINYTEXT" )      { this->Init(Dbi::kString,kMaxMySQLVarchar);   return; }
00096   if ( name == "TEXT" )          { this->Init(Dbi::kString,kMaxMySQLText);   return; }
00097   if ( name == "DATE" )          { this->Init(Dbi::kDate);   return; }
00098   if ( name == "DATETIME" )      { this->Init(Dbi::kDate);   return; }
00099 
00100   // Handle character types
00101 
00102   if ( type == TSQLServer::kSQL_CHAR && size <= kMaxChar ) {
00103     this->Init(Dbi::kChar,size);
00104     return;
00105   }
00106   if ( type == TSQLServer::kSQL_CHAR || type == TSQLServer::kSQL_VARCHAR ) {
00107     if ( size < kMaxMySQLVarchar ) Init(Dbi::kString,size);
00108     else                           Init(Dbi::kString,kMaxMySQLText);
00109     return;
00110   }
00111 
00112   // Anything else is bad news!
00113 
00114   MAXMSG("Dbi",Msg::kError,20) 
00115         << "Unable to form SQL DbiFieldType from: " << type << endl;
00116   this->Init(Dbi::kUnknown);
00117 
00118 }

DbiFieldType::DbiFieldType ( const DbiFieldType from  ) 

Definition at line 122 of file DbiFieldType.cxx.

References LEA_CTOR.

00123 {
00124 //
00125 //
00126 //  Purpose:  Copy constructor
00127 
00128 //  Program Notes:-
00129 //  =============
00130 
00131 //  Make explicit for leak checking.
00132 
00133   LEA_CTOR    //Leak Checker
00134 
00135   *this = from;
00136 }

DbiFieldType::DbiFieldType ( const string &  sql,
Int_t  size 
)

Definition at line 140 of file DbiFieldType.cxx.

References fSize, Init(), Dbi::kChar, Dbi::kDate, Dbi::kDouble, Msg::kError, Dbi::kFloat, Dbi::kInt, Dbi::kLong, kMaxChar, kMaxMySQLText, kMaxMySQLVarchar, Dbi::kShort, Dbi::kString, Dbi::kTiny, Dbi::kUnknown, LEA_CTOR, and MAXMSG.

00142 {
00143 //
00144 //
00145 //  Purpose:  Constructor from a MySQL type string
00146 
00147 
00148   LEA_CTOR    //Leak Checker
00149 
00150 
00151   if (         sql == "TINYINT" )   this->Init(Dbi::kTiny); 
00152 
00153   else if (    sql == "SMALLINT" )  this->Init(Dbi::kShort);
00154 
00155   else if (    sql == "INT" 
00156             || sql == "INTEGER" 
00157             || sql == "NUMERIC" )   this->Init(Dbi::kInt);
00158 
00159   else if (     sql == "BIGINT" )   this->Init(Dbi::kLong);
00160 
00161   else if (    sql == "FLOAT"  
00162             || sql == "REAL")       this->Init(Dbi::kFloat);
00163 
00164   else if (    sql == "DOUBLE" )    this->Init(Dbi::kDouble);
00165 
00166   else if (    sql == "CHAR" 
00167             || sql == "VARCHAR"
00168             || sql == "TEXT"  
00169             || sql == "TINYTEXT" ) {
00170 
00171     if      ( sql == "TINYTEXT" ) size = kMaxMySQLVarchar;
00172     else if ( sql == "TEXT"     ) size = kMaxMySQLText;
00173     else {
00174       if ( size < 0 ) {
00175         if ( sql == "CHAR" ) size = 1;
00176         else                 size = kMaxMySQLVarchar -1;
00177       }
00178     }
00179     if ( fSize <= kMaxChar ) this->Init(Dbi::kChar,size);
00180     else                     this->Init(Dbi::kString,size);
00181 
00182   }
00183 
00184   else if ( sql == "DATETIME" )     this->Init(Dbi::kDate);
00185 
00186   else {
00187     MAXMSG("Dbi",Msg::kError,20) 
00188       << "Unable to type from SQL: " << sql << endl;
00189                                     this->Init(Dbi::kUnknown);
00190   }
00191     
00192 }

DbiFieldType::~DbiFieldType (  )  [virtual]

Definition at line 197 of file DbiFieldType.cxx.

References LEA_DTOR.

00197                             {
00198 //
00199 //
00200 //  Purpose: Destructor
00201 //
00202 //  Arguments: 
00203 //    None.
00204 //
00205 //  Return:    n/a
00206 //
00207 //  Contact:   N. West
00208 //
00209 //  Specification:-
00210 //  =============
00211 //
00212 //  o  Destroy FieldType.
00213 
00214 
00215 //  Program Notes:-
00216 //  =============
00217 
00218 //  None.
00219 
00220   LEA_DTOR    //Leak Checker
00221 
00222 
00223 }


Member Function Documentation

string DbiFieldType::AsSQLString ( Dbi::DbTypes  dbType = Dbi::kMySQL  )  const

Definition at line 271 of file DbiFieldType.cxx.

References fSize, fType, Dbi::kBool, Dbi::kChar, Dbi::kDate, Dbi::kDouble, Dbi::kFloat, Dbi::kInt, Dbi::kLong, kMaxChar, kMaxMySQLVarchar, kMaxOracleVarchar, Dbi::kOracle, Dbi::kShort, Dbi::kString, Dbi::kTiny, Dbi::kTString, Dbi::kUChar, Dbi::kUInt, Dbi::kULong, Dbi::kUShort, Dbi::kUTiny, and size.

Referenced by DbiTableMetaData::Sql().

00271                                                         {
00272 //
00273 //
00274 //  Purpose:  Return field type as a string suitable for MySQL/ORACLE column.
00275 
00276   ostringstream os;
00277 
00278 //  Deal with MySQL ddl
00279 
00280   if ( dbType != Dbi::kOracle ) {
00281     switch ( fType ) {
00282     
00283       case  Dbi::kBool    :   os << "CHAR";          break;
00284 
00285       case  Dbi::kUTiny   :
00286       case  Dbi::kTiny    :   os << "TINYINT";       break;
00287 
00288       case  Dbi::kShort   : 
00289       case  Dbi::kUShort  :   os << "SMALLINT";      break;
00290 
00291       case  Dbi::kInt     : 
00292       case  Dbi::kUInt    :   os << "INT";           break;
00293 
00294       case  Dbi::kLong    : 
00295       case  Dbi::kULong   :   os << "BIGINT";        break;
00296 
00297       case  Dbi::kFloat   :   os << "FLOAT";         break;
00298 
00299       case  Dbi::kDouble  :   os << "DOUBLE";        break;
00300 
00301       case  Dbi::kChar    : 
00302       case  Dbi::kUChar   : 
00303       case  Dbi::kString  : 
00304       case  Dbi::kTString : 
00305         if      ( fSize == 1)                os << "CHAR";
00306         else if ( fSize <= kMaxChar)         os << "CHAR("    << fSize << ')';
00307         else if ( fSize <  kMaxMySQLVarchar) os << "VARCHAR(" << fSize << ')';
00308         else if ( fSize == kMaxMySQLVarchar) os << "TINYTEXT";
00309         else                                 os << "TEXT";
00310         break;
00311 
00312       case  Dbi::kDate    :   os << "DATETIME";      break;
00313 
00314       default :               os << "Unknown";
00315 
00316     }
00317   }
00318 
00319   else {
00320 
00321 //  Deal with ORACLE ddl
00322 
00323 
00324     int size = fSize;
00325     if ( fSize < kMaxOracleVarchar ) size = kMaxOracleVarchar;
00326 
00327     switch ( fType ) {
00328 
00329       case  Dbi::kBool    :   os << "CHAR";          break;
00330 
00331       case  Dbi::kUTiny   :
00332       case  Dbi::kTiny    :   os << "NUMBER(4)";     break;
00333 
00334       case  Dbi::kShort   : 
00335       case  Dbi::kUShort  :   os << "NUMBER(6)";     break;
00336 
00337       case  Dbi::kInt     : 
00338       case  Dbi::kUInt    :   os << "NUMBER(11)";    break;
00339 
00340       case  Dbi::kLong    : 
00341       case  Dbi::kULong   :   os << "NUMBER(20)";    break;
00342 
00343       case  Dbi::kFloat   :   os << "BINARY_FLOAT";  break;
00344 
00345       case  Dbi::kDouble  :   os << "BINARY_DOUBLE"; break;
00346 
00347       case  Dbi::kChar    : 
00348       case  Dbi::kUChar   : 
00349       case  Dbi::kString  : 
00350       case  Dbi::kTString :
00351         if      ( size == 1)        os << "CHAR";
00352         else if ( size <= kMaxChar) os << "CHAR("    << size << ')';
00353         else                        os << "VARCHAR(" << size << ')';
00354         break;
00355 
00356       case  Dbi::kDate    :   os << "DATE";          break;
00357 
00358       default :               os << "Unknown";
00359 
00360     }
00361   }
00362 
00363   return os.str();
00364 
00365 }

string DbiFieldType::AsString (  )  const

Definition at line 227 of file DbiFieldType.cxx.

References fType, Dbi::kBool, Dbi::kChar, Dbi::kDate, Dbi::kDouble, Dbi::kFloat, Dbi::kInt, Dbi::kLong, Dbi::kShort, Dbi::kString, Dbi::kTiny, Dbi::kTString, Dbi::kUChar, Dbi::kUInt, Dbi::kULong, Dbi::kUShort, and Dbi::kUTiny.

Referenced by DbiResultSet::AsString(), operator<<(), DbiTableMetaData::SetFromSql(), and DbiOutRowStream::StoreDefaultIfInvalid().

00227                                     {
00228 //
00229 //
00230 //  Purpose:  Return field type as a string.
00231 //
00232 //  Arguments: None.
00233 //
00234 //  Return:    Field type as a string e.g. "Int"
00235 //
00236 //  Contact:   N. West
00237 //
00238 //  Specification:-
00239 //  =============
00240 //
00241 //  o Return field type as a string.
00242 
00243 //  Program Notes:-
00244 //  =============
00245 
00246 //  None.
00247 
00248   switch ( fType ) {
00249 
00250   case  Dbi::kBool    : return "Bool";  
00251   case  Dbi::kChar    : return "Char";
00252   case  Dbi::kUChar   : return "UChar";
00253   case  Dbi::kTiny    : return "Tiny";
00254   case  Dbi::kUTiny   : return "UTiny";
00255   case  Dbi::kShort   : return "Short";
00256   case  Dbi::kUShort  : return "UShort";
00257   case  Dbi::kInt     : return "Int";
00258   case  Dbi::kUInt    : return "UInt";
00259   case  Dbi::kLong    : return "Long";
00260   case  Dbi::kULong   : return "ULong";
00261   case  Dbi::kFloat   : return "Float";
00262   case  Dbi::kDouble  : return "Double";
00263   case  Dbi::kString  : return "String";
00264   case  Dbi::kTString : return "TString";
00265   case  Dbi::kDate    : return "Date";
00266   }
00267   return "Unknown";
00268 }

UInt_t DbiFieldType::GetConcept (  )  const [inline]
UInt_t DbiFieldType::GetSize (  )  const [inline]

Definition at line 67 of file DbiFieldType.h.

References fSize.

00067 { return fSize; }

UInt_t DbiFieldType::GetType (  )  const [inline]

Definition at line 68 of file DbiFieldType.h.

References fType.

Referenced by DbiResultSet::RowAsCsv().

00068 { return fType; }

void DbiFieldType::Init ( Int_t  type,
Int_t  size = -1 
) [private]

Definition at line 371 of file DbiFieldType.cxx.

References fConcept, fSize, fType, Dbi::kBool, Dbi::kChar, Dbi::kDate, Dbi::kDouble, Msg::kError, Dbi::kFloat, Dbi::kInt, Dbi::kLong, Dbi::kShort, Dbi::kString, Dbi::kTiny, Dbi::kTString, Dbi::kUChar, Dbi::kUInt, Dbi::kULong, Dbi::kUnknown, Dbi::kUShort, Dbi::kUTiny, and MAXMSG.

Referenced by DbiFieldType().

00372                                                              : -1 - take size from type)*/ ) {
00373 //
00374 //
00375 //  Purpose:  Initialise object.
00376 //
00377 
00378   switch ( type ) {
00379 
00380   case Dbi::kBool : 
00381       fType      = Dbi::kBool; 
00382       fConcept   = Dbi::kBool;
00383       fSize      = 1;
00384       break;
00385 
00386     case Dbi::kChar :
00387       fType      = Dbi::kChar;
00388       fConcept   = Dbi::kChar;
00389       fSize      = 1;
00390       break;
00391 
00392     case Dbi::kUChar :
00393       fType      = Dbi::kUChar;
00394       fConcept   = Dbi::kUChar;
00395       fSize      = 1;
00396       break;
00397 
00398     case Dbi::kTiny :
00399       fType      = Dbi::kTiny;
00400       fConcept   = Dbi::kInt;
00401       fSize      = 1;
00402       break;
00403 
00404     case Dbi::kUTiny :
00405       fType      = Dbi::kUTiny;
00406       fConcept   = Dbi::kUInt;
00407       fSize      = 1;
00408       break;
00409 
00410     case Dbi::kShort :
00411       fType      = Dbi::kShort;
00412       fConcept   = Dbi::kInt;
00413       fSize      = 2;
00414       break;
00415 
00416     case Dbi::kUShort :
00417       fType      = Dbi::kUShort;
00418       fConcept   = Dbi::kUInt;
00419       fSize      = 2;
00420       break;
00421 
00422     case Dbi::kInt :
00423       fType      = Dbi::kInt;
00424       fConcept   = Dbi::kInt;
00425       fSize      = 4;
00426       break;
00427 
00428     case Dbi::kUInt :
00429       fType      = Dbi::kUInt;
00430       fConcept   = Dbi::kUInt;
00431       fSize      = 4;
00432       break;
00433 
00434     case Dbi::kLong :
00435       fType    = Dbi::kLong;
00436       fConcept = Dbi::kInt;
00437       fSize    = 8;
00438       break;
00439 
00440     case Dbi::kULong :
00441       fType    = Dbi::kULong;
00442       fConcept = Dbi::kUInt;
00443       fSize    = 8;
00444       break;
00445 
00446     case Dbi::kFloat :
00447       fType      = Dbi::kFloat;
00448       fConcept   = Dbi::kFloat;
00449       fSize      = 4;
00450       break;
00451 
00452     case Dbi::kDouble :
00453       fType      = Dbi::kDouble;
00454       fConcept   = Dbi::kFloat;
00455       fSize      = 8;
00456       break;
00457 
00458     case Dbi::kString :
00459       fType      = Dbi::kString;
00460       fConcept   = Dbi::kString;
00461       fSize      = 65535;
00462       break;
00463 
00464     case Dbi::kTString :
00465       fType      = Dbi::kTString;
00466       fConcept   = Dbi::kString;
00467       fSize      = 65535;
00468       break;
00469 
00470     case Dbi::kDate :
00471       fType      = Dbi::kDate;
00472       fConcept   = Dbi::kDate;
00473       fSize      = 4;
00474       break;
00475 
00476     case Dbi::kUnknown :
00477       fType      = Dbi::kUnknown;
00478       fConcept   = Dbi::kUnknown;
00479       break;
00480 
00481     default : 
00482       MAXMSG("Dbi",Msg::kError,20)
00483         << "Unable to form Root DbiFieldType from: " << type << endl;
00484       fType      = Dbi::kUnknown;
00485       fConcept   = Dbi::kUnknown;
00486       fSize      = 0;
00487   }
00488 
00489   // Override fSize if necessary.
00490 
00491   if ( size      >= 0  ) fSize      = size;
00492 
00493 }

Bool_t DbiFieldType::IsCompatible ( const DbiFieldType other  )  const

Definition at line 497 of file DbiFieldType.cxx.

References fConcept, GetConcept(), Dbi::kBool, Dbi::kChar, Dbi::kInt, Dbi::kString, Dbi::kUChar, Dbi::kUInt, and MATCHES.

Referenced by DbiResultSet::AsString(), and DbiOutRowStream::StoreDefaultIfInvalid().

00497                                                                  {
00498 //
00499 //
00500 //  Purpose: Return kTRUE if this is compatible with or can accept
00501 //           the other type. 
00502 //
00503 //  Arguments: 
00504 //    other        in    The DbiFieldType to be compared
00505 //
00506 //  Return: kTRUE if the this type can accept other type.    
00507 //
00508 //  Contact:   N. West
00509 //
00510 //  Specification:-
00511 //  =============
00512 //
00513 //  o If the two types have the same concept or have compatible 
00514 //    concepts return kTRUE.
00515 //
00516 //  o Also return true if the other type can be be used as input.
00517 //
00518 
00519 //  Program Notes:-
00520 //  =============
00521 
00522 //  None.
00523 
00524 #define MATCHES(x,y)  \
00525      ( (fConcept == x) && (concept == y) )  \
00526   || ( (fConcept == y) && (concept == x) )
00527 
00528   UInt_t concept = other.GetConcept();
00529   if ( fConcept == concept ) return kTRUE;
00530   if ( MATCHES(Dbi::kBool,  Dbi::kChar)  ) return kTRUE;
00531   if ( MATCHES(Dbi::kBool,  Dbi::kUChar) ) return kTRUE;
00532   if ( MATCHES(Dbi::kInt,   Dbi::kChar)  ) return kTRUE;
00533   if ( MATCHES(Dbi::kUInt,  Dbi::kUChar) ) return kTRUE;
00534 //  Allow unsigned to match signed because the TSQLResultSetL interface
00535 //  does not support unsigned types but its GetShort and GetInt
00536 //  methods will return unsigned data intact so we must trust
00537 //  that the user knows what they are doing!
00538   if ( MATCHES(Dbi::kUInt,  Dbi::kInt)   ) return kTRUE;
00539 //  Allow char to be input to string.
00540   if ( concept == Dbi::kChar && fConcept == Dbi::kString ) return kTRUE;
00541 
00542 return kFALSE;
00543 
00544 }

Bool_t DbiFieldType::IsEqual ( const DbiFieldType other  )  const [inline]

Definition at line 70 of file DbiFieldType.h.

References fType.

00071                                         { return fType == other.fType; }

Bool_t DbiFieldType::IsSigned (  )  const [inline]

Definition at line 74 of file DbiFieldType.h.

References fConcept, and Dbi::kInt.

Referenced by SetUnsigned().

00074 { return fConcept ==  Dbi::kInt; }

Bool_t DbiFieldType::IsSmaller ( const DbiFieldType other  )  const [inline]

Definition at line 72 of file DbiFieldType.h.

References fSize.

Referenced by DbiResultSet::AsString().

00073                                   { return fSize < other.fSize; }

void DbiFieldType::SetUnsigned (  )  [inline]

Definition at line 79 of file DbiFieldType.h.

References fConcept, fType, and IsSigned().

00079 {if (this->IsSigned()) {++fConcept; ++fType;}}

string DbiFieldType::UndefinedValue (  )  const

Definition at line 548 of file DbiFieldType.cxx.

References fConcept, Dbi::kBool, Dbi::kChar, Dbi::kDate, Msg::kError, Dbi::kFloat, Dbi::kInt, Dbi::kString, Dbi::kUChar, Dbi::kUInt, and MAXMSG.

Referenced by DbiResultSet::AsString(), and DbiOutRowStream::StoreDefaultIfInvalid().

00548                                           {
00549 //
00550 //
00551 //  Purpose:  Return value to be used when unknown.
00552 //
00553 //  Arguments: None
00554 //
00555 //  Return:   Value as a string to be used when unknown. 
00556 //
00557 //  Contact:   N. West
00558 //
00559 //  Specification:-
00560 //  =============
00561 //
00562 //  o Return value to be used when unknown.
00563 
00564 //  Program Notes:-
00565 //  =============
00566 
00567 //  For each conceptual data type there is an associated 
00568 //  data type to be used when attemping to get value from outside
00569 //  the table or when table type incompatible with data.
00570 
00571 
00572   switch ( fConcept ) {
00573     case Dbi::kBool   : return "0";
00574     case Dbi::kChar   : return "";
00575     case Dbi::kUChar  : return "";
00576     case Dbi::kInt    : return "-999";
00577     case Dbi::kUInt   : return " 999";
00578     case Dbi::kFloat  : return "-999.";
00579     case Dbi::kString : return "";
00580     case Dbi::kDate   : return "1980-00-00 00:00:00";
00581 
00582     default : 
00583       MAXMSG("Dbi",Msg::kError,20) << "Unable to define undefined type for: " 
00584             << fConcept << endl;
00585       return "";
00586   }
00587 }


Member Data Documentation

unsigned int DbiFieldType::fConcept [private]

Concept e.g. kInt or kFloat.

Definition at line 88 of file DbiFieldType.h.

Referenced by GetConcept(), Init(), IsCompatible(), IsSigned(), SetUnsigned(), and UndefinedValue().

unsigned int DbiFieldType::fSize [private]

Size in bytes(0 if unknown).

Definition at line 90 of file DbiFieldType.h.

Referenced by AsSQLString(), DbiFieldType(), GetSize(), Init(), and IsSmaller().

unsigned int DbiFieldType::fType [private]

Concept e.g. kShort or kDouble.

Definition at line 92 of file DbiFieldType.h.

Referenced by AsSQLString(), AsString(), GetType(), Init(), IsEqual(), and SetUnsigned().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1