A class to contain the results of a database query. More...
#include <database.h>
Public Member Functions | |
bool | GetColumnIndex (const string &column_name, int *index) const |
Get the column number corresponding to some column name. | |
template<class FieldType > | |
bool | GetField (const size_t column_num, const size_t row_num, FieldType *result) const |
int | NumColumns () const |
int | NumRows () const |
bool | Populate (QSqlQuery query) |
Fill this Table from some query. | |
Table () | |
Private Attributes | |
map< string, int > | column_names_ |
A map from column names to indices in the data_ vector. | |
vector< vector< QVariant > > | data_ |
A 2D vector that contains the actual data returned from the database. | |
int | num_columns_ |
int | num_rows_ |
A class to contain the results of a database query.
Definition at line 46 of file database.h.
db_planner::Table::Table | ( | ) | [inline] |
Definition at line 54 of file database.h.
bool db_planner::Table::GetColumnIndex | ( | const string & | column_name, | |
int * | index | |||
) | const [inline] |
Get the column number corresponding to some column name.
Definition at line 64 of file database.h.
bool db_planner::Table::GetField | ( | const size_t | column_num, | |
const size_t | row_num, | |||
FieldType * | result | |||
) | const [inline] |
Get the value stored at (column_num, row_num) statically types as the FieldType template parameter.
Definition at line 74 of file database.h.
int db_planner::Table::NumColumns | ( | ) | const [inline] |
Definition at line 56 of file database.h.
int db_planner::Table::NumRows | ( | ) | const [inline] |
Definition at line 58 of file database.h.
bool db_planner::Table::Populate | ( | QSqlQuery | query | ) |
Fill this Table from some query.
Take the result of a SQL query and copy the results to a Table object.
Note that this is always a copy, and does not allow for using a recordset or cursor.
Definition at line 47 of file database.cpp.
map<string, int> db_planner::Table::column_names_ [private] |
A map from column names to indices in the data_ vector.
Definition at line 51 of file database.h.
vector<vector<QVariant> > db_planner::Table::data_ [private] |
A 2D vector that contains the actual data returned from the database.
Definition at line 49 of file database.h.
int db_planner::Table::num_columns_ [private] |
Definition at line 52 of file database.h.
int db_planner::Table::num_rows_ [private] |
Definition at line 52 of file database.h.