TSQLColumnInfo.h

Go to the documentation of this file.
00001 // @(#)root/net:$Id: TSQLColumnInfo.h 23091 2008-04-09 15:04:27Z rdm $
00002 // Author: Sergey Linev   31/05/2006
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TSQLColumnInfo
00013 #define ROOT_TSQLColumnInfo
00014 
00015 #ifndef ROOT_TNamed
00016 #include "TNamed.h"
00017 #endif
00018 
00019 class TSQLColumnInfo : public TNamed {
00020 
00021 protected:
00022    // Database specific fields 
00023    TString  fTypeName;   //! sql type name, as reported by DB. Should be as much as close to declaration of column in CREATE TABLE query
00024    
00025    // Database independent fields
00026    Int_t    fSQLType;    //! datatype code (see TSQLServer::ESQLDataTypes constants), -1 if not defeined
00027    Int_t    fSize;       //! size of column in bytes, -1 if not defing
00028    Int_t    fLength;     //! datatype length definition, for instance VARCHAR(len) or FLOAT(len), -1 if not defined
00029    Int_t    fScale;      //! datatype scale factor, used for instance in NUMBER(len,scale) definition. -1 if not defined
00030    Int_t    fSigned;     //! if datatype signed or not, 0 - kFALSE, 1 - kTRUE, -1 - unknown
00031    Bool_t   fNullable;   //! identify if value can be NULL 
00032 
00033 public:
00034    TSQLColumnInfo();
00035    TSQLColumnInfo(const char* columnname,
00036                   const char* sqltypename = "unknown",
00037                   Bool_t nullable = kFALSE,
00038                   Int_t sqltype = -1,
00039                   Int_t size = -1,
00040                   Int_t length = -1,
00041                   Int_t scale = -1,
00042                   Int_t sign = -1);
00043    virtual ~TSQLColumnInfo() {}
00044    
00045    const char* GetTypeName() const { return fTypeName.Data(); }
00046    Bool_t      IsNullable()  const { return fNullable; }
00047    Int_t       GetSQLType()  const { return fSQLType; }
00048    Int_t       GetSize()     const { return fSize; }
00049    Int_t       GetLength()   const { return fLength; }
00050    Int_t       GetScale()    const { return fScale; }
00051    Int_t       GetSigned()   const { return fSigned; }
00052    Bool_t      IsSigned()    const { return fSigned==1; }
00053    Bool_t      IsUnsigned()  const { return fSigned==0; }
00054    
00055    virtual void Print(Option_t* option = "") const;
00056 
00057    ClassDef(TSQLColumnInfo, 0) // Summury information about column from SQL table
00058 };
00059 
00060 #endif

Generated on Tue Jul 5 14:28:12 2011 for ROOT_528-00b_version by  doxygen 1.5.1