CGEM BOSS 6.6.5.h
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
}
 
enum  CONTENTS {
  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)
 

Friends

class rdbModel::XercesBuilder
 

Detailed Description

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

Definition at line 23 of file Column.h.

Member Enumeration Documentation

◆ CONTENTS

Hints to program in case FROM field is FROMprogram.

Enumerator
CONTENTSunspecified 
CONTENTSserviceName 
CONTENTSusername 
CONTENTSinsertTime 
CONTENTSupdateTime 

Definition at line 39 of file Column.h.

39 {
45
46 };
@ CONTENTSserviceName
Definition Column.h:41
@ CONTENTSunspecified
Definition Column.h:40

◆ FROM

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 

Definition at line 30 of file Column.h.

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

Constructor & Destructor Documentation

◆ Column()

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

Definition at line 48 of file Column.h.

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

◆ ~Column()

rdbModel::Column::~Column ( )

Definition at line 11 of file Column.cxx.

11 {
12 delete m_type;
13 }

Member Function Documentation

◆ accept()

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

◆ getComment()

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

Definition at line 57 of file Column.h.

57{return m_comment;};

◆ getContentsType()

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

Definition at line 89 of file Column.h.

89{return m_contents;}

◆ getDatatype()

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

Definition at line 63 of file Column.h.

63{return m_type;};

Referenced by main(), and rdbModel::MysqlConnection::visitColumn().

◆ getDefault()

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

Definition at line 59 of file Column.h.

59{return m_default;}

◆ getEnum()

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.

15{return m_type->getEnum();}
Enum * getEnum() const
Definition Datatype.h:64

◆ getName()

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

Definition at line 56 of file Column.h.

56{return m_name; };

Referenced by rdbModel::ColCompare::operator()(), tryQuick(), and rdbModel::MysqlConnection::visitColumn().

◆ getSourceType()

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

Definition at line 88 of file Column.h.

88{return m_from;}

◆ getTableName()

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

Definition at line 17 of file Column.cxx.

17 {
18 return m_myTable->getName();
19 }
const std::string & getName() const
Definition Table.h:40

◆ interpret()

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
TYPES getType() const
Definition Datatype.h:59

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

◆ isAutoIncrement()

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().

◆ isCompatible()

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().

◆ isPrimaryKey()

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

Definition at line 84 of file Column.h.

84{return m_isPrimaryKey;}

Referenced by main().

◆ nullAllowed()

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

Returns true if column may take on value NULL.

Definition at line 80 of file Column.h.

80{ return m_null;}

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

◆ okValue()

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().

◆ stickyInsert()

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

Definition at line 82 of file Column.h.

82{ return m_stickyInsert;}

Friends And Related Symbol Documentation

◆ rdbModel::XercesBuilder

friend class rdbModel::XercesBuilder
friend

Definition at line 102 of file Column.h.


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