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
17class TSQLColumnInfo : public TNamed {
18
19protected:
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
31public:
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
const Bool_t kFALSE
Definition: RtypesCore.h:90
const char Option_t
Definition: RtypesCore.h:64
#define ClassDef(name, id)
Definition: Rtypes.h:322
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
Int_t fSQLType
sql type name, as reported by DB. Should be as much as close to declaration of column in CREATE TABLE...
Int_t GetSize() const
Bool_t IsUnsigned() const
Int_t fSize
datatype code (see TSQLServer::ESQLDataTypes constants), -1 if not defeined
Bool_t fNullable
if datatype signed or not, 0 - kFALSE, 1 - kTRUE, -1 - unknown
const char * GetTypeName() const
Int_t GetLength() const
Int_t GetSigned() const
Int_t GetSQLType() const
virtual ~TSQLColumnInfo()
Int_t fScale
datatype length definition, for instance VARCHAR(len) or FLOAT(len), -1 if not defined
Int_t GetScale() const
Bool_t IsSigned() const
Int_t fLength
size of column in bytes, -1 if not defing
virtual void Print(Option_t *option="") const
Prints column information to standard output.
Bool_t IsNullable() const
TSQLColumnInfo()
identify if value can be NULL
Int_t fSigned
datatype scale factor, used for instance in NUMBER(len,scale) definition. -1 if not defined
Basic string class.
Definition: TString.h:131
struct void * fTypeName
Definition: cppyy.h:9