Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TSQLColumnInfo.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/net:$Id$
0002 // Author: Sergey Linev   31/05/2006
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TSQLColumnInfo
0013 #define ROOT_TSQLColumnInfo
0014 
0015 #include "TNamed.h"
0016 
0017 class TSQLColumnInfo : public TNamed {
0018 
0019 protected:
0020    // Database specific fields
0021    TString  fTypeName;   //! sql type name, as reported by DB. Should be as much as close to declaration of column in CREATE TABLE query
0022 
0023    // Database independent fields
0024    Int_t    fSQLType;    //! datatype code (see TSQLServer::ESQLDataTypes constants), -1 if not defeined
0025    Int_t    fSize;       //! size of column in bytes, -1 if not defing
0026    Int_t    fLength;     //! datatype length definition, for instance VARCHAR(len) or FLOAT(len), -1 if not defined
0027    Int_t    fScale;      //! datatype scale factor, used for instance in NUMBER(len,scale) definition. -1 if not defined
0028    Int_t    fSigned;     //! if datatype signed or not, 0 - kFALSE, 1 - kTRUE, -1 - unknown
0029    Bool_t   fNullable;   //! identify if value can be NULL
0030 
0031 public:
0032    TSQLColumnInfo();
0033    TSQLColumnInfo(const char* columnname,
0034                   const char* sqltypename = "unknown",
0035                   Bool_t nullable = kFALSE,
0036                   Int_t sqltype = -1,
0037                   Int_t size = -1,
0038                   Int_t length = -1,
0039                   Int_t scale = -1,
0040                   Int_t sign = -1);
0041    virtual ~TSQLColumnInfo() {}
0042 
0043    const char* GetTypeName() const { return fTypeName.Data(); }
0044    Bool_t      IsNullable()  const { return fNullable; }
0045    Int_t       GetSQLType()  const { return fSQLType; }
0046    Int_t       GetSize()     const { return fSize; }
0047    Int_t       GetLength()   const { return fLength; }
0048    Int_t       GetScale()    const { return fScale; }
0049    Int_t       GetSigned()   const { return fSigned; }
0050    Bool_t      IsSigned()    const { return fSigned==1; }
0051    Bool_t      IsUnsigned()  const { return fSigned==0; }
0052 
0053    void Print(Option_t* option = "") const override;
0054 
0055    ClassDefOverride(TSQLColumnInfo, 0) // Summury information about column from SQL table
0056 };
0057 
0058 #endif