#include <Rdb.h>
Public Member Functions | |
unsigned int | accept (Visitor *v) |
This is the recursive accept for the visitor pattern. | |
unsigned int | accept (Visitor *v) |
This is the recursive accept for the visitor pattern. | |
Column * | getColumn (const std::string &tableName, const std::string &colName) const |
Column * | getColumn (const std::string &tableName, const std::string &colName) const |
const std::string & | getCVSid () |
const std::string & | getCVSid () |
const std::string & | getDbName () |
const std::string & | getDbName () |
Index * | getIndex (const std::string &tableName, const std::string &indexName) const |
Index * | getIndex (const std::string &tableName, const std::string &indexName) const |
unsigned | getMajorVersion () |
unsigned | getMajorVersion () |
unsigned | getMinorVersion () |
unsigned | getMinorVersion () |
unsigned int | getNTable () const |
unsigned int | getNTable () const |
Table * | getTable (const std::string &name) const |
Table * | getTable (const std::string &name) const |
int | insertLatest (const std::string &tName, Row &row, int *serial=0) const |
int | insertLatest (Table *t, Row &row, int *serial=0) const |
int | insertLatest (const std::string &tName, Row &row, int *serial=0) const |
int | insertLatest (Table *t, Row &row, int *serial=0) const |
int | insertRow (const std::string &tName, Row &row, int *serial=0) const |
int | insertRow (const std::string &tName, Row &row, int *serial=0) const |
Rdb () | |
Rdb () | |
void | setConnection (Connection *connection) |
void | setConnection (Connection *connection) |
int | supersedeRow (const std::string &tName, Row &row, int oldKey, int *newKey=0) const |
int | supersedeRow (const std::string &tName, Row &row, int oldKey, int *newKey=0) const |
int | updateRows (const std::string &tName, Row &row, Assertion *where) const |
int | updateRows (const std::string &tName, Row &row, Assertion *where) const |
virtual | ~Rdb () |
virtual | ~Rdb () |
Private Member Functions | |
void | addTable (Table *t) |
void | addTable (Table *t) |
void | setCVSid (std::string pcvs) |
void | setCVSid (std::string pcvs) |
Private Attributes | |
Connection * | m_connection |
Connection * | m_connection |
std::string | m_CVSid |
The CVSid from the input xml description. | |
std::string | m_dbName |
SQL database name (e.g., "calib"). | |
unsigned | m_majorVersion |
The Schema version from the input xml description. | |
unsigned | m_minorVersion |
std::vector< Table * > | m_tables |
std::vector< Table * > | m_tables |
Friends | |
class | rdbModel::XercesBuilder |
Adapted from detModel::Gdd class, written by R. Giannitrapani and D. Favretto
|
This is the destructor; it should be called only by the manager destructor. It starts the destruction of all the objects created by the builder 00008 { 00009 while (m_tables.size() ) { 00010 Table* table = m_tables.back(); 00011 m_tables.pop_back(); 00012 delete table; 00013 } 00014 }
|
|
00048 : m_connection(0) { }
|
|
This is the destructor; it should be called only by the manager destructor. It starts the destruction of all the objects created by the builder |
|
00048 : m_connection(0) { }
|
|
This is the recursive accept for the visitor pattern.
|
|
This is the recursive accept for the visitor pattern.
00098 { 00099 Visitor::VisitorState state = v->visitRdb(this); 00100 if (state != Visitor::VCONTINUE) return state; 00101 00102 unsigned nTable = m_tables.size(); 00103 00104 for (unsigned i = 0; i < nTable; i++) { 00105 state = m_tables[i]->accept(v); 00106 if (state != Visitor::VCONTINUE) return state; 00107 } 00108 return state; 00109 }
|
|
00117 {m_tables.push_back(t);};
|
|
00117 {m_tables.push_back(t);};
|
|
|
|
00026 { 00027 Table* table = getTable(tableName); 00028 if (!table) return 0; 00029 00030 return table->getColumnByName(colName); 00031 00032 }
|
|
00054 {return m_CVSid;};
|
|
00054 {return m_CVSid;};
|
|
00056 {return m_dbName;};
|
|
00056 {return m_dbName;};
|
|
|
|
00035 { 00036 Table* table = getTable(tableName); 00037 if (!table) return 0; 00038 00039 return table->getIndexByName(indexName); 00040 00041 }
|
|
00051 {return m_majorVersion;};
|
|
00051 {return m_majorVersion;};
|
|
00052 {return m_minorVersion;};
|
|
00052 {return m_minorVersion;};
|
|
00068 {return m_tables.size();}
|
|
00068 {return m_tables.size();}
|
|
|
|
00016 { 00017 unsigned nTable = m_tables.size(); 00018 for (unsigned iTable = 0; iTable < nTable; iTable++) { 00019 Table* table = m_tables[iTable]; 00020 if (table->getName() == name) return table; 00021 } 00022 return 0; 00023 }
|
|
|
|
The two forms of smart insert, in addition to filling in the service fields, as insertRow does, do various forms of consistency checking and may even update pre-existing rows. |
|
00077 { 00078 Table* t = getTable(tName); 00079 if (!t) { 00080 std::string msg("Rdb::insertLatest unknown table "); 00081 msg = msg + tName; 00082 throw RdbException(msg); 00083 } 00084 return (t->insertLatest(row, serial)); 00085 }
|
|
The two forms of smart insert, in addition to filling in the service fields, as insertRow does, do various forms of consistency checking and may even update pre-existing rows. 00072 { 00073 return (t->insertLatest(row, serial)); 00074 }
|
|
insertRow has only one value-added feature as compared to an SQL insert: it will take care of fields intended to be filled by the service (e.g., insert and update timestamps) |
|
insertRow has only one value-added feature as compared to an SQL insert: it will take care of fields intended to be filled by the service (e.g., insert and update timestamps) 00052 { 00053 Table* t = getTable(tName); 00054 if (!t) { 00055 std::string msg("Rdb::insertRow unknown table "); 00056 msg = msg + tName; 00057 throw RdbException(msg); 00058 } 00059 return (t->insertRow(row, serial)); 00060 }
|
|
|
|
00043 { 00044 m_connection = connection; 00045 00046 // propagate to all our tables as well 00047 for (unsigned i = 0; i < m_tables.size(); i++) { 00048 m_tables[i]->setConnection(connection); 00049 } 00050 }
|
|
00115 {m_CVSid = pcvs;};
|
|
00115 {m_CVSid = pcvs;};
|
|
|
|
00088 { 00089 Table* t = getTable(tName); 00090 if (!t) { 00091 std::string msg("Rdb::supersedeRow unknown table "); 00092 msg = msg + tName; 00093 throw RdbException(msg); 00094 } 00095 return (t->supersedeRow(row, oldKey, newKey)); 00096 }
|
|
Fills in service fields, then invokes Connection::update |
|
Fills in service fields, then invokes Connection::update 00062 { 00063 Table* t = getTable(tName); 00064 if (!t) { 00065 std::string msg("Rdb::insertRow unknown table "); 00066 msg = msg + tName; 00067 throw RdbException(msg); 00068 } 00069 return (t->updateRows(row, where)); 00070 }
|
|
|
|
|
|
|
|
The CVSid from the input xml description.
|
|
SQL database name (e.g., "calib").
|
|
The Schema version from the input xml description.
|
|
|
|
|
|
|