#include <Column.h>
Definition at line 23 of file Column.h.
Hints to program in case FROM field is FROMprogram.
CONTENTSunspecified | |
CONTENTSserviceName | |
CONTENTSusername | |
CONTENTSinsertTime | |
CONTENTSupdateTime |
Definition at line 39 of file Column.h.
00039 { 00040 CONTENTSunspecified = 0, 00041 CONTENTSserviceName = 1, 00042 CONTENTSusername = 2, 00043 CONTENTSinsertTime = 3, 00044 CONTENTSupdateTime = 4 00045 00046 };
Source of value. Note timestamp with value current time should be indicated by contents value CONTENTSupdateTime or (if only upon insert) CONTENTS enterTime
Definition at line 30 of file Column.h.
00030 { 00031 FROMdefault = 1, // enduser can override default, however 00032 FROMautoIncrement, 00033 FROMnow, // datatype must be timestamp - deprecated 00034 FROMprogram, 00035 FROMendUser 00036 };
rdbModel::Column::Column | ( | Table * | myTable = 0 |
) | [inline] |
Definition at line 48 of file Column.h.
References CONTENTSunspecified, m_contents, m_default, and deljobs::string.
00048 : m_myTable(myTable), m_type(0), 00049 m_isPrimaryKey(false) { 00050 m_contents = CONTENTSunspecified; 00051 m_default = std::string("");};
rdbModel::Column::~Column | ( | ) |
Visitor::VisitorState rdbModel::Column::accept | ( | Visitor * | v | ) |
Definition at line 58 of file Column.cxx.
References v, rdbModel::Visitor::VBRANCHDONE, and rdbModel::Visitor::VCONTINUE.
00058 { 00059 00060 Visitor::VisitorState state = v->visitColumn(this); 00061 if (state == Visitor::VBRANCHDONE) return Visitor::VCONTINUE; 00062 return state; 00063 }
const std::string& rdbModel::Column::getComment | ( | ) | const [inline] |
CONTENTS rdbModel::Column::getContentsType | ( | ) | const [inline] |
Datatype* rdbModel::Column::getDatatype | ( | ) | const [inline] |
const std::string& rdbModel::Column::getDefault | ( | ) | const [inline] |
Definition at line 59 of file Column.h.
References m_default.
Referenced by rdbModel::Table::addColumn().
00059 {return m_default;}
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.
References rdbModel::Datatype::getEnum(), and m_type.
00015 {return m_type->getEnum();}
const std::string& rdbModel::Column::getName | ( | ) | const [inline] |
Definition at line 56 of file Column.h.
References m_name.
Referenced by rdbModel::ColCompare::operator()(), tryQuick(), and rdbModel::MysqlConnection::visitColumn().
00056 {return m_name; };
FROM rdbModel::Column::getSourceType | ( | ) | const [inline] |
Definition at line 88 of file Column.h.
References m_from.
Referenced by rdbModel::Table::addColumn().
00088 {return m_from;}
const std::string & rdbModel::Column::getTableName | ( | ) | const |
Definition at line 17 of file Column.cxx.
References rdbModel::Table::getName(), and m_myTable.
00017 { 00018 return m_myTable->getName(); 00019 }
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.
References rdbModel::Datatype::getType(), m_type, deljobs::string, rdbModel::Datatype::TYPEdatetime, and rdbModel::Datatype::TYPEtimestamp.
Referenced by rdbModel::Table::doInterUpdate(), and rdbModel::Table::supersedeRow().
00041 { 00042 // Currently only interpretation is for timestamp-like columns. 00043 // Value of interpType must be "time" and val must be "NOW". 00044 // In this case, substitute ascii current time 00045 if (interpType.compare(std::string("time")) != 0) return false; 00046 00047 Datatype::TYPES dtype = m_type->getType(); 00048 if ((dtype != Datatype::TYPEdatetime) && 00049 (dtype != Datatype::TYPEtimestamp)) { 00050 return false; 00051 } 00052 if (val.compare(std::string("NOW")) != 0) return false; 00053 00054 val = facilities::Timestamp().getString(); 00055 return true; 00056 }
bool rdbModel::Column::isAutoIncrement | ( | ) | const |
Definition at line 37 of file Column.cxx.
References FROMautoIncrement, and m_from.
Referenced by rdbModel::MysqlConnection::visitColumn().
00037 { 00038 return (m_from == FROMautoIncrement); 00039 }
Return true if otherCol and this have compatible datatypes.
Definition at line 32 of file Column.cxx.
References rdbModel::Datatype::isCompatible(), and m_type.
Referenced by rdbModel::Assertion::Operator::validCompareOp().
00032 { 00033 return m_type->isCompatible(otherCol->m_type); 00034 }
bool rdbModel::Column::isPrimaryKey | ( | ) | const [inline] |
Definition at line 84 of file Column.h.
References m_isPrimaryKey.
Referenced by main().
00084 {return m_isPrimaryKey;}
bool rdbModel::Column::nullAllowed | ( | ) | const [inline] |
Returns true if column may take on value NULL.
Definition at line 80 of file Column.h.
References m_null.
Referenced by rdbModel::Table::addColumn(), and rdbModel::MysqlConnection::visitColumn().
00080 { return m_null;}
bool rdbModel::Column::okValue | ( | const std::string & | val, | |
bool | set = true | |||
) | const |
See if supplied value meets constraints of column definition
Definition at line 21 of file Column.cxx.
References FROMautoIncrement, FROMnow, m_from, m_type, and rdbModel::Datatype::okValue().
Referenced by rdbModel::Assertion::Operator::validCompareOp().
00021 { 00022 // auto increment and datetime values are established by rdbms 00023 if (set) { 00024 00025 if ( (m_from == FROMautoIncrement) || 00026 (m_from == FROMnow)) return false; 00027 } 00028 00029 return m_type->okValue(val); 00030 }
bool rdbModel::Column::stickyInsert | ( | ) | const [inline] |
friend class rdbModel::XercesBuilder [friend] |
std::string rdbModel::Column::m_comment [private] |
CONTENTS rdbModel::Column::m_contents [private] |
std::string rdbModel::Column::m_default [private] |
FROM rdbModel::Column::m_from [private] |
Definition at line 111 of file Column.h.
Referenced by getSourceType(), isAutoIncrement(), and okValue().
bool rdbModel::Column::m_isPrimaryKey [private] |
Is this column a primary key?
Definition at line 121 of file Column.h.
Referenced by isPrimaryKey().
Table* rdbModel::Column::m_myTable [private] |
std::string rdbModel::Column::m_name [private] |
bool rdbModel::Column::m_null [private] |
Can this field have the value NULL?
Definition at line 115 of file Column.h.
Referenced by nullAllowed().
bool rdbModel::Column::m_stickyInsert [private] |
For multi-insert, does this column normally keep same value for all the inserts?
Definition at line 118 of file Column.h.
Referenced by stickyInsert().
Datatype* rdbModel::Column::m_type [private] |
Definition at line 108 of file Column.h.
Referenced by getDatatype(), getEnum(), interpret(), isCompatible(), okValue(), and ~Column().