ROOT logo
// @(#)root/net:$Id: TSQLColumnInfo.h 23091 2008-04-09 15:04:27Z rdm $
// Author: Sergey Linev   31/05/2006

/*************************************************************************
 * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TSQLColumnInfo
#define ROOT_TSQLColumnInfo

#ifndef ROOT_TNamed
#include "TNamed.h"
#endif

class TSQLColumnInfo : public TNamed {

protected:
   // Database specific fields 
   TString  fTypeName;   //! sql type name, as reported by DB. Should be as much as close to declaration of column in CREATE TABLE query
   
   // Database independent fields
   Int_t    fSQLType;    //! datatype code (see TSQLServer::ESQLDataTypes constants), -1 if not defeined
   Int_t    fSize;       //! size of column in bytes, -1 if not defing
   Int_t    fLength;     //! datatype length definition, for instance VARCHAR(len) or FLOAT(len), -1 if not defined
   Int_t    fScale;      //! datatype scale factor, used for instance in NUMBER(len,scale) definition. -1 if not defined
   Int_t    fSigned;     //! if datatype signed or not, 0 - kFALSE, 1 - kTRUE, -1 - unknown
   Bool_t   fNullable;   //! identify if value can be NULL 

public:
   TSQLColumnInfo();
   TSQLColumnInfo(const char* columnname,
                  const char* sqltypename = "unknown",
                  Bool_t nullable = kFALSE,
                  Int_t sqltype = -1,
                  Int_t size = -1,
                  Int_t length = -1,
                  Int_t scale = -1,
                  Int_t sign = -1);
   virtual ~TSQLColumnInfo() {}
   
   const char* GetTypeName() const { return fTypeName.Data(); }
   Bool_t      IsNullable()  const { return fNullable; }
   Int_t       GetSQLType()  const { return fSQLType; }
   Int_t       GetSize()     const { return fSize; }
   Int_t       GetLength()   const { return fLength; }
   Int_t       GetScale()    const { return fScale; }
   Int_t       GetSigned()   const { return fSigned; }
   Bool_t      IsSigned()    const { return fSigned==1; }
   Bool_t      IsUnsigned()  const { return fSigned==0; }
   
   virtual void Print(Option_t* option = "") const;

   ClassDef(TSQLColumnInfo, 0) // Summury information about column from SQL table
};

#endif
 TSQLColumnInfo.h:1
 TSQLColumnInfo.h:2
 TSQLColumnInfo.h:3
 TSQLColumnInfo.h:4
 TSQLColumnInfo.h:5
 TSQLColumnInfo.h:6
 TSQLColumnInfo.h:7
 TSQLColumnInfo.h:8
 TSQLColumnInfo.h:9
 TSQLColumnInfo.h:10
 TSQLColumnInfo.h:11
 TSQLColumnInfo.h:12
 TSQLColumnInfo.h:13
 TSQLColumnInfo.h:14
 TSQLColumnInfo.h:15
 TSQLColumnInfo.h:16
 TSQLColumnInfo.h:17
 TSQLColumnInfo.h:18
 TSQLColumnInfo.h:19
 TSQLColumnInfo.h:20
 TSQLColumnInfo.h:21
 TSQLColumnInfo.h:22
 TSQLColumnInfo.h:23
 TSQLColumnInfo.h:24
 TSQLColumnInfo.h:25
 TSQLColumnInfo.h:26
 TSQLColumnInfo.h:27
 TSQLColumnInfo.h:28
 TSQLColumnInfo.h:29
 TSQLColumnInfo.h:30
 TSQLColumnInfo.h:31
 TSQLColumnInfo.h:32
 TSQLColumnInfo.h:33
 TSQLColumnInfo.h:34
 TSQLColumnInfo.h:35
 TSQLColumnInfo.h:36
 TSQLColumnInfo.h:37
 TSQLColumnInfo.h:38
 TSQLColumnInfo.h:39
 TSQLColumnInfo.h:40
 TSQLColumnInfo.h:41
 TSQLColumnInfo.h:42
 TSQLColumnInfo.h:43
 TSQLColumnInfo.h:44
 TSQLColumnInfo.h:45
 TSQLColumnInfo.h:46
 TSQLColumnInfo.h:47
 TSQLColumnInfo.h:48
 TSQLColumnInfo.h:49
 TSQLColumnInfo.h:50
 TSQLColumnInfo.h:51
 TSQLColumnInfo.h:52
 TSQLColumnInfo.h:53
 TSQLColumnInfo.h:54
 TSQLColumnInfo.h:55
 TSQLColumnInfo.h:56
 TSQLColumnInfo.h:57
 TSQLColumnInfo.h:58
 TSQLColumnInfo.h:59
 TSQLColumnInfo.h:60