Logo ROOT  
Reference Guide
TSQLColumnInfo.h
Go to the documentation of this file.
1 // @(#)root/net:$Id$
2 // Author: Sergey Linev 31/05/2006
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TSQLColumnInfo
13 #define ROOT_TSQLColumnInfo
14 
15 #include "TNamed.h"
16 
17 class TSQLColumnInfo : public TNamed {
18 
19 protected:
20  // Database specific fields
21  TString fTypeName; //! sql type name, as reported by DB. Should be as much as close to declaration of column in CREATE TABLE query
22 
23  // Database independent fields
24  Int_t fSQLType; //! datatype code (see TSQLServer::ESQLDataTypes constants), -1 if not defeined
25  Int_t fSize; //! size of column in bytes, -1 if not defing
26  Int_t fLength; //! datatype length definition, for instance VARCHAR(len) or FLOAT(len), -1 if not defined
27  Int_t fScale; //! datatype scale factor, used for instance in NUMBER(len,scale) definition. -1 if not defined
28  Int_t fSigned; //! if datatype signed or not, 0 - kFALSE, 1 - kTRUE, -1 - unknown
29  Bool_t fNullable; //! identify if value can be NULL
30 
31 public:
33  TSQLColumnInfo(const char* columnname,
34  const char* sqltypename = "unknown",
35  Bool_t nullable = kFALSE,
36  Int_t sqltype = -1,
37  Int_t size = -1,
38  Int_t length = -1,
39  Int_t scale = -1,
40  Int_t sign = -1);
41  virtual ~TSQLColumnInfo() {}
42 
43  const char* GetTypeName() const { return fTypeName.Data(); }
44  Bool_t IsNullable() const { return fNullable; }
45  Int_t GetSQLType() const { return fSQLType; }
46  Int_t GetSize() const { return fSize; }
47  Int_t GetLength() const { return fLength; }
48  Int_t GetScale() const { return fScale; }
49  Int_t GetSigned() const { return fSigned; }
50  Bool_t IsSigned() const { return fSigned==1; }
51  Bool_t IsUnsigned() const { return fSigned==0; }
52 
53  virtual void Print(Option_t* option = "") const;
54 
55  ClassDef(TSQLColumnInfo, 0) // Summury information about column from SQL table
56 };
57 
58 #endif
TSQLColumnInfo::TSQLColumnInfo
TSQLColumnInfo()
identify if value can be NULL
Definition: TSQLColumnInfo.cxx:50
TSQLColumnInfo
Definition: TSQLColumnInfo.h:17
Option_t
const char Option_t
Definition: RtypesCore.h:66
TSQLColumnInfo::GetSigned
Int_t GetSigned() const
Definition: TSQLColumnInfo.h:49
TSQLColumnInfo::fSize
Int_t fSize
datatype code (see TSQLServer::ESQLDataTypes constants), -1 if not defeined
Definition: TSQLColumnInfo.h:25
TNamed.h
TSQLColumnInfo::GetScale
Int_t GetScale() const
Definition: TSQLColumnInfo.h:48
TSQLColumnInfo::fLength
Int_t fLength
size of column in bytes, -1 if not defing
Definition: TSQLColumnInfo.h:26
TSQLColumnInfo::IsUnsigned
Bool_t IsUnsigned() const
Definition: TSQLColumnInfo.h:51
TString
Basic string class.
Definition: TString.h:136
bool
TSQLColumnInfo::GetSize
Int_t GetSize() const
Definition: TSQLColumnInfo.h:46
TSQLColumnInfo::GetSQLType
Int_t GetSQLType() const
Definition: TSQLColumnInfo.h:45
TSQLColumnInfo::fNullable
Bool_t fNullable
if datatype signed or not, 0 - kFALSE, 1 - kTRUE, -1 - unknown
Definition: TSQLColumnInfo.h:29
TNamed
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TSQLColumnInfo::fScale
Int_t fScale
datatype length definition, for instance VARCHAR(len) or FLOAT(len), -1 if not defined
Definition: TSQLColumnInfo.h:27
TSQLColumnInfo::~TSQLColumnInfo
virtual ~TSQLColumnInfo()
Definition: TSQLColumnInfo.h:41
TSQLColumnInfo::fSQLType
Int_t fSQLType
sql type name, as reported by DB. Should be as much as close to declaration of column in CREATE TABLE...
Definition: TSQLColumnInfo.h:24
TSQLColumnInfo::GetLength
Int_t GetLength() const
Definition: TSQLColumnInfo.h:47
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TSQLColumnInfo::IsNullable
Bool_t IsNullable() const
Definition: TSQLColumnInfo.h:44
TSQLColumnInfo::fTypeName
TString fTypeName
Definition: TSQLColumnInfo.h:21
fTypeName
struct void * fTypeName
Definition: cppyy.h:9
TSQLColumnInfo::fSigned
Int_t fSigned
datatype scale factor, used for instance in NUMBER(len,scale) definition. -1 if not defined
Definition: TSQLColumnInfo.h:28
TSQLColumnInfo::Print
virtual void Print(Option_t *option="") const
Prints column information to standard output.
Definition: TSQLColumnInfo.cxx:87
TSQLColumnInfo::IsSigned
Bool_t IsSigned() const
Definition: TSQLColumnInfo.h:50
TSQLColumnInfo::GetTypeName
const char * GetTypeName() const
Definition: TSQLColumnInfo.h:43
int