#include <Column.h>
Public Member Functions | |
Row () | |
Row (std::vector< FieldVal > &fields) | |
~Row () | |
void | rowSort () |
void | addField (const FieldVal &f) |
void | clear () |
FieldVal * | find (std::string colname) |
void | regroup (std::vector< std::string > &colNames, std::vector< std::string > &colVals, std::vector< std::string > &nullCols) const |
Reorder information suitable for Connection::insert. | |
Private Attributes | |
std::vector< FieldVal > | m_fields |
bool | m_sorted |
Definition at line 150 of file Column.h.
rdbModel::Row::Row | ( | ) | [inline] |
rdbModel::Row::Row | ( | std::vector< FieldVal > & | fields | ) | [inline] |
rdbModel::Row::~Row | ( | ) | [inline] |
void rdbModel::Row::addField | ( | const FieldVal & | f | ) | [inline] |
Definition at line 157 of file Column.h.
References m_fields, and m_sorted.
Referenced by rdbModel::Table::fillDefaults(), rdbModel::Table::fillProgramCols(), and rdbModel::Table::supersedeRow().
void rdbModel::Row::clear | ( | ) | [inline] |
FieldVal * rdbModel::Row::find | ( | std::string | colname | ) |
Definition at line 73 of file Column.cxx.
References m_fields.
Referenced by rdbModel::Table::doInterUpdate(), rdbModel::Table::fillDefaults(), rdbModel::Table::fillProgramCols(), rdbModel::Table::insertLatest(), rdbModel::Table::insertRow(), rdbModel::Assertion::Operator::Operator(), rdbModel::Table::supersedeRow(), rdbModel::Assertion::Operator::verify(), and rdbModel::Assertion::Operator::verifyCompare().
00073 { 00074 unsigned nField = m_fields.size(); 00075 unsigned minI = 0; 00076 unsigned maxI = nField; 00077 00078 unsigned guess = maxI/2; 00079 unsigned oldGuess = nField; 00080 00081 int cmp = colname.compare(m_fields[guess].m_colname); 00082 00083 while (cmp != 0) { 00084 if (guess == oldGuess) return 0; // not found 00085 00086 if (cmp < 0 ) { // thing we tried is > colName, so decrease maxI 00087 maxI = guess; 00088 } else { // thing we tried is > colName, so increase minI 00089 minI = guess; 00090 } 00091 oldGuess = guess; 00092 guess = (minI + maxI)/2; 00093 cmp = colname.compare(m_fields[guess].m_colname); 00094 } 00095 return &m_fields[guess]; 00096 }
void rdbModel::Row::regroup | ( | std::vector< std::string > & | colNames, | |
std::vector< std::string > & | colVals, | |||
std::vector< std::string > & | nullCols | |||
) | const |
Reorder information suitable for Connection::insert.
Definition at line 98 of file Column.cxx.
References genRecEmupikp::i, and m_fields.
Referenced by rdbModel::Table::doInterUpdate(), rdbModel::Table::insertLatest(), rdbModel::Table::insertRow(), and rdbModel::Table::updateRows().
00100 { 00101 unsigned nFields = m_fields.size(); 00102 colNames.reserve(nFields); 00103 colVals.reserve(nFields); 00104 00105 for (unsigned i = 0; i < nFields; i++) { 00106 if (m_fields[i].m_null) { 00107 nullCols.push_back(m_fields[i].m_colname); 00108 } 00109 else { 00110 colNames.push_back(m_fields[i].m_colname); 00111 colVals.push_back(m_fields[i].m_val); 00112 } 00113 } 00114 }
void rdbModel::Row::rowSort | ( | ) |
Definition at line 65 of file Column.cxx.
References m_fields, and m_sorted.
Referenced by rdbModel::Assertion::Assertion(), rdbModel::Table::fillDefaults(), rdbModel::Table::fillProgramCols(), rdbModel::Table::insertLatest(), rdbModel::Table::insertRow(), rdbModel::Table::supersedeRow(), rdbModel::Table::updateRows(), and rdbModel::Assertion::verify().
00065 { 00066 if (m_sorted) return; 00067 00068 FieldValCompare cmp; 00069 std::sort(m_fields.begin(), m_fields.end(), cmp); 00070 m_sorted = true; 00071 }
std::vector<FieldVal> rdbModel::Row::m_fields [private] |
bool rdbModel::Row::m_sorted [private] |