#include <recordset.h>
Public Member Functions | |
RecordSet (void) throw () | |
Default constructor. | |
~RecordSet (void) throw () | |
Destructor. | |
void | clear (void) |
Remove all the records. | |
bool | isEmpty (void) const |
Check if the RecordSet is empty. | |
unsigned int | rows (void) const |
Get the number of rows. | |
unsigned int | cols (void) const |
Get the number of columns. | |
void | setColumnHeaders (const Row &headers) |
Set the column headers. | |
void | add (const Row &row) |
Add a new row. | |
const std::string & | operator() (const unsigned int row, const unsigned int col) const |
Operator() Get the value of a particular field of a particular row by field index. | |
const std::string & | operator() (const unsigned int row, const std::string &name) const |
Operator() Get the value of a particular field of a particular row by field name (slower than by field index). | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const RecordSet &rhs) |
Operator<< Append the stringified RecordSet to the output stream. |
Limitations:
Definition at line 45 of file recordset.h.
void dal::RecordSet::clear | ( | void | ) |
Remove all the records.
Remove all the Records.
Definition at line 57 of file recordset.cpp.
Referenced by dal::SqLiteDataProvider::execSql(), dal::PqDataProvider::execSql(), and dal::MySqlDataProvider::execSql().
bool dal::RecordSet::isEmpty | ( | void | ) | const |
Check if the RecordSet is empty.
Definition at line 68 of file recordset.cpp.
Referenced by DALStorage::banCharacter(), DALStorage::getGuildList(), DALStorage::getQuestVar(), DALStorage::getStoredPost(), and DALStorage::getWorldStateVar().
unsigned int dal::RecordSet::rows | ( | void | ) | const |
Get the number of rows.
Definition at line 80 of file recordset.cpp.
Referenced by DALStorage::getGuildList(), DALStorage::getStoredPost(), and DALStorage::getTransactions().
unsigned int dal::RecordSet::cols | ( | void | ) | const |
Get the number of columns.
Definition at line 92 of file recordset.cpp.
void dal::RecordSet::setColumnHeaders | ( | const Row & | headers | ) |
Set the column headers.
headers | the column headers. |
AlreadySetException | if the column headers are already set. |
Definition at line 102 of file recordset.cpp.
Referenced by dal::SqLiteDataProvider::execSql(), dal::PqDataProvider::execSql(), and dal::MySqlDataProvider::execSql().
void dal::RecordSet::add | ( | const Row & | row | ) |
Add a new row.
This method does not check the field data types, only the number of columns is checked.
row | the new row. |
RsColumnHeadersNotSet | if the row is being added before the column headers. | |
std::invalid_argument | if the number of columns in the new row is not equal to the number of column headers. |
Definition at line 116 of file recordset.cpp.
Referenced by dal::SqLiteDataProvider::execSql(), dal::PqDataProvider::execSql(), and dal::MySqlDataProvider::execSql().
const std::string & dal::RecordSet::operator() | ( | const unsigned int | row, | |
const unsigned int | col | |||
) | const |
Operator() Get the value of a particular field of a particular row by field index.
Operator().
row | the row index. | |
col | the field index. |
std::out_of_range | if row or col are out of range. | |
std::invalid_argument | if the recordset is empty. |
Definition at line 140 of file recordset.cpp.
const std::string & dal::RecordSet::operator() | ( | const unsigned int | row, | |
const std::string & | name | |||
) | const |
Operator() Get the value of a particular field of a particular row by field name (slower than by field index).
Operator().
row | the row index. | |
name | the field name. |
std::out_of_range | if the row index is out of range. | |
std::invalid_argument | if the field name is not found or the recordset is empty. |
Definition at line 160 of file recordset.cpp.
std::ostream& operator<< | ( | std::ostream & | out, | |
const RecordSet & | rhs | |||
) | [friend] |
Operator<< Append the stringified RecordSet to the output stream.
out | the output stream. | |
rhs | the right hand side. |
Definition at line 198 of file recordset.cpp.