BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
rdbModel::Column Class Reference

#include <Column.h>

Public Types

enum  FROM {
  FROMdefault = 1 , FROMautoIncrement , FROMnow , FROMprogram ,
  FROMendUser , FROMdefault = 1 , FROMautoIncrement , FROMnow ,
  FROMprogram , FROMendUser
}
 
enum  CONTENTS {
  CONTENTSunspecified = 0 , CONTENTSserviceName = 1 , CONTENTSusername = 2 , CONTENTSinsertTime = 3 ,
  CONTENTSupdateTime = 4 , CONTENTSunspecified = 0 , CONTENTSserviceName = 1 , CONTENTSusername = 2 ,
  CONTENTSinsertTime = 3 , CONTENTSupdateTime = 4
}
 Hints to program in case FROM field is FROMprogram. More...
 
enum  FROM {
  FROMdefault = 1 , FROMautoIncrement , FROMnow , FROMprogram ,
  FROMendUser , FROMdefault = 1 , FROMautoIncrement , FROMnow ,
  FROMprogram , FROMendUser
}
 
enum  CONTENTS {
  CONTENTSunspecified = 0 , CONTENTSserviceName = 1 , CONTENTSusername = 2 , CONTENTSinsertTime = 3 ,
  CONTENTSupdateTime = 4 , CONTENTSunspecified = 0 , CONTENTSserviceName = 1 , CONTENTSusername = 2 ,
  CONTENTSinsertTime = 3 , CONTENTSupdateTime = 4
}
 Hints to program in case FROM field is FROMprogram. More...
 

Public Member Functions

 Column (Table *myTable=0)
 
 ~Column ()
 
const std::string & getName () const
 
const std::string & getComment () const
 
const std::string & getDefault () const
 
const std::string & getTableName () const
 
DatatypegetDatatype () const
 
EnumgetEnum () const
 
bool okValue (const std::string &val, bool set=true) const
 
bool isCompatible (const Column *otherCol) const
 Return true if otherCol and this have compatible datatypes.
 
bool nullAllowed () const
 Returns true if column may take on value NULL.
 
bool stickyInsert () const
 
bool isPrimaryKey () const
 
bool isAutoIncrement () const
 
FROM getSourceType () const
 
CONTENTS getContentsType () const
 
bool interpret (const std::string &interpType, std::string &val)
 
Visitor::VisitorState accept (Visitor *v)
 
 Column (Table *myTable=0)
 
 ~Column ()
 
const std::string & getName () const
 
const std::string & getComment () const
 
const std::string & getDefault () const
 
const std::string & getTableName () const
 
DatatypegetDatatype () const
 
EnumgetEnum () const
 
bool okValue (const std::string &val, bool set=true) const
 
bool isCompatible (const Column *otherCol) const
 Return true if otherCol and this have compatible datatypes.
 
bool nullAllowed () const
 Returns true if column may take on value NULL.
 
bool stickyInsert () const
 
bool isPrimaryKey () const
 
bool isAutoIncrement () const
 
FROM getSourceType () const
 
CONTENTS getContentsType () const
 
bool interpret (const std::string &interpType, std::string &val)
 
Visitor::VisitorState accept (Visitor *v)
 

Friends

class rdbModel::XercesBuilder
 

Detailed Description

rdbModel representation of a(n SQL-like) table description

Definition at line 23 of file Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Tables/Column.h.

Member Enumeration Documentation

◆ CONTENTS [1/2]

Hints to program in case FROM field is FROMprogram.

Enumerator
CONTENTSunspecified 
CONTENTSserviceName 
CONTENTSusername 
CONTENTSinsertTime 
CONTENTSupdateTime 
CONTENTSunspecified 
CONTENTSserviceName 
CONTENTSusername 
CONTENTSinsertTime 
CONTENTSupdateTime 

Definition at line 39 of file Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Tables/Column.h.

◆ CONTENTS [2/2]

Hints to program in case FROM field is FROMprogram.

Enumerator
CONTENTSunspecified 
CONTENTSserviceName 
CONTENTSusername 
CONTENTSinsertTime 
CONTENTSupdateTime 
CONTENTSunspecified 
CONTENTSserviceName 
CONTENTSusername 
CONTENTSinsertTime 
CONTENTSupdateTime 

Definition at line 39 of file InstallArea/include/rdbModel/rdbModel/Tables/Column.h.

◆ FROM [1/2]

Source of value. Note timestamp with value current time should be indicated by contents value CONTENTSupdateTime or (if only upon insert) CONTENTS enterTime

Enumerator
FROMdefault 
FROMautoIncrement 
FROMnow 
FROMprogram 
FROMendUser 
FROMdefault 
FROMautoIncrement 
FROMnow 
FROMprogram 
FROMendUser 

Definition at line 30 of file Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Tables/Column.h.

◆ FROM [2/2]

Source of value. Note timestamp with value current time should be indicated by contents value CONTENTSupdateTime or (if only upon insert) CONTENTS enterTime

Enumerator
FROMdefault 
FROMautoIncrement 
FROMnow 
FROMprogram 
FROMendUser 
FROMdefault 
FROMautoIncrement 
FROMnow 
FROMprogram 
FROMendUser 

Definition at line 30 of file InstallArea/include/rdbModel/rdbModel/Tables/Column.h.

30 {
31 FROMdefault = 1, // enduser can override default, however
33 FROMnow, // datatype must be timestamp - deprecated
36 };

Constructor & Destructor Documentation

◆ Column() [1/2]

rdbModel::Column::Column ( Table myTable = 0)
inline

Definition at line 48 of file Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Tables/Column.h.

48 : m_myTable(myTable), m_type(0),
49 m_isPrimaryKey(false) {
50 m_contents = CONTENTSunspecified;
51 m_default = std::string("");};

◆ ~Column() [1/2]

rdbModel::Column::~Column ( )

Definition at line 11 of file Column.cxx.

11 {
12 delete m_type;
13 }

◆ Column() [2/2]

rdbModel::Column::Column ( Table myTable = 0)
inline

Definition at line 48 of file InstallArea/include/rdbModel/rdbModel/Tables/Column.h.

48 : m_myTable(myTable), m_type(0),
49 m_isPrimaryKey(false) {
50 m_contents = CONTENTSunspecified;
51 m_default = std::string("");};

◆ ~Column() [2/2]

rdbModel::Column::~Column ( )

Member Function Documentation

◆ accept() [1/2]

Visitor::VisitorState rdbModel::Column::accept ( Visitor v)

Definition at line 58 of file Column.cxx.

58 {
59
60 Visitor::VisitorState state = v->visitColumn(this);
61 if (state == Visitor::VBRANCHDONE) return Visitor::VCONTINUE;
62 return state;
63 }
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35

◆ accept() [2/2]

Visitor::VisitorState rdbModel::Column::accept ( Visitor v)

◆ getComment() [1/2]

const std::string & rdbModel::Column::getComment ( ) const
inline

Definition at line 57 of file Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Tables/Column.h.

57{return m_comment;};

◆ getComment() [2/2]

const std::string & rdbModel::Column::getComment ( ) const
inline

Definition at line 57 of file InstallArea/include/rdbModel/rdbModel/Tables/Column.h.

57{return m_comment;};

◆ getContentsType() [1/2]

CONTENTS rdbModel::Column::getContentsType ( ) const
inline

Definition at line 89 of file Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Tables/Column.h.

89{return m_contents;}

◆ getContentsType() [2/2]

CONTENTS rdbModel::Column::getContentsType ( ) const
inline

Definition at line 89 of file InstallArea/include/rdbModel/rdbModel/Tables/Column.h.

89{return m_contents;}

◆ getDatatype() [1/2]

Datatype * rdbModel::Column::getDatatype ( ) const
inline

◆ getDatatype() [2/2]

Datatype * rdbModel::Column::getDatatype ( ) const
inline

Definition at line 63 of file InstallArea/include/rdbModel/rdbModel/Tables/Column.h.

63{return m_type;};

◆ getDefault() [1/2]

const std::string & rdbModel::Column::getDefault ( ) const
inline

Definition at line 59 of file Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Tables/Column.h.

59{return m_default;}

◆ getDefault() [2/2]

const std::string & rdbModel::Column::getDefault ( ) const
inline

Definition at line 59 of file InstallArea/include/rdbModel/rdbModel/Tables/Column.h.

59{return m_default;}

◆ getEnum() [1/2]

Enum * rdbModel::Column::getEnum ( ) const

Return pointer to Enum object associated with this column (if none, return null pointer).

Definition at line 15 of file Column.cxx.

◆ getEnum() [2/2]

Enum * rdbModel::Column::getEnum ( ) const

Return pointer to Enum object associated with this column (if none, return null pointer).

◆ getName() [1/2]

const std::string & rdbModel::Column::getName ( ) const
inline

◆ getName() [2/2]

const std::string & rdbModel::Column::getName ( ) const
inline

Definition at line 56 of file InstallArea/include/rdbModel/rdbModel/Tables/Column.h.

56{return m_name; };

◆ getSourceType() [1/2]

FROM rdbModel::Column::getSourceType ( ) const
inline

Definition at line 88 of file Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Tables/Column.h.

88{return m_from;}

◆ getSourceType() [2/2]

FROM rdbModel::Column::getSourceType ( ) const
inline

Definition at line 88 of file InstallArea/include/rdbModel/rdbModel/Tables/Column.h.

88{return m_from;}

◆ getTableName() [1/2]

const std::string & rdbModel::Column::getTableName ( ) const

Definition at line 17 of file Column.cxx.

17 {
18 return m_myTable->getName();
19 }

◆ getTableName() [2/2]

const std::string & rdbModel::Column::getTableName ( ) const

◆ interpret() [1/2]

bool rdbModel::Column::interpret ( const std::string &  interpType,
std::string &  val 
)

Handle special literal values, depending loosely on column datatype. Most Column objects won't do any interpretation, but, for example, timestamp-like columns may substitute for "NOW" Return true if any substitution was done

Definition at line 41 of file Column.cxx.

41 {
42 // Currently only interpretation is for timestamp-like columns.
43 // Value of interpType must be "time" and val must be "NOW".
44 // In this case, substitute ascii current time
45 if (interpType.compare(std::string("time")) != 0) return false;
46
47 Datatype::TYPES dtype = m_type->getType();
48 if ((dtype != Datatype::TYPEdatetime) &&
49 (dtype != Datatype::TYPEtimestamp)) {
50 return false;
51 }
52 if (val.compare(std::string("NOW")) != 0) return false;
53
55 return true;
56 }
std::string getString() const
Return string representation of time, not including nanoseconds;.
Definition: Timestamp.cxx:92

Referenced by rdbModel::Table::supersedeRow().

◆ interpret() [2/2]

bool rdbModel::Column::interpret ( const std::string &  interpType,
std::string &  val 
)

Handle special literal values, depending loosely on column datatype. Most Column objects won't do any interpretation, but, for example, timestamp-like columns may substitute for "NOW" Return true if any substitution was done

◆ isAutoIncrement() [1/2]

bool rdbModel::Column::isAutoIncrement ( ) const

Definition at line 37 of file Column.cxx.

37 {
38 return (m_from == FROMautoIncrement);
39 }

Referenced by rdbModel::MysqlConnection::visitColumn().

◆ isAutoIncrement() [2/2]

bool rdbModel::Column::isAutoIncrement ( ) const

◆ isCompatible() [1/2]

bool rdbModel::Column::isCompatible ( const Column otherCol) const

Return true if otherCol and this have compatible datatypes.

Definition at line 32 of file Column.cxx.

32 {
33 return m_type->isCompatible(otherCol->m_type);
34 }
bool isCompatible(const Datatype *other) const
Definition: Datatype.cxx:237

Referenced by rdbModel::Assertion::Operator::validCompareOp().

◆ isCompatible() [2/2]

bool rdbModel::Column::isCompatible ( const Column otherCol) const

Return true if otherCol and this have compatible datatypes.

◆ isPrimaryKey() [1/2]

bool rdbModel::Column::isPrimaryKey ( ) const
inline

Definition at line 84 of file Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Tables/Column.h.

84{return m_isPrimaryKey;}

Referenced by main().

◆ isPrimaryKey() [2/2]

bool rdbModel::Column::isPrimaryKey ( ) const
inline

Definition at line 84 of file InstallArea/include/rdbModel/rdbModel/Tables/Column.h.

84{return m_isPrimaryKey;}

◆ nullAllowed() [1/2]

bool rdbModel::Column::nullAllowed ( ) const
inline

Returns true if column may take on value NULL.

Definition at line 80 of file Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Tables/Column.h.

80{ return m_null;}

Referenced by calibUtil::Metadata::checkNulls(), and rdbModel::MysqlConnection::visitColumn().

◆ nullAllowed() [2/2]

bool rdbModel::Column::nullAllowed ( ) const
inline

Returns true if column may take on value NULL.

Definition at line 80 of file InstallArea/include/rdbModel/rdbModel/Tables/Column.h.

80{ return m_null;}

◆ okValue() [1/2]

bool rdbModel::Column::okValue ( const std::string &  val,
bool  set = true 
) const

See if supplied value meets constraints of column definition

  • val std::string representation of value to be checked
  • set true if value is to be written to column; false if just being used, e.g. in "where" clause

Definition at line 21 of file Column.cxx.

21 {
22 // auto increment and datetime values are established by rdbms
23 if (set) {
24
25 if ( (m_from == FROMautoIncrement) ||
26 (m_from == FROMnow)) return false;
27 }
28
29 return m_type->okValue(val);
30 }
bool okValue(const std::string &val) const
Definition: Datatype.cxx:164

Referenced by calibUtil::Metadata::checkValues(), and rdbModel::Assertion::Operator::validCompareOp().

◆ okValue() [2/2]

bool rdbModel::Column::okValue ( const std::string &  val,
bool  set = true 
) const

See if supplied value meets constraints of column definition

  • val std::string representation of value to be checked
  • set true if value is to be written to column; false if just being used, e.g. in "where" clause

◆ stickyInsert() [1/2]

bool rdbModel::Column::stickyInsert ( ) const
inline

Definition at line 82 of file Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Tables/Column.h.

82{ return m_stickyInsert;}

◆ stickyInsert() [2/2]

bool rdbModel::Column::stickyInsert ( ) const
inline

Definition at line 82 of file InstallArea/include/rdbModel/rdbModel/Tables/Column.h.

82{ return m_stickyInsert;}

Friends And Related Function Documentation

◆ rdbModel::XercesBuilder


The documentation for this class was generated from the following files: