OpenASIP
2.0
|
#include <SQLiteQueryResult.hh>
Public Member Functions | |
SQLiteQueryResult (sqlite3_stmt *statement, SQLiteConnection *connection, bool init=true) | |
virtual | ~SQLiteQueryResult () |
virtual int | columns () const |
virtual std::string | columnName (std::size_t columnIndex) const |
virtual const DataObject & | data (std::size_t columnIndex) const |
virtual const DataObject & | data (const std::string &name) const |
virtual bool | hasNext () |
virtual bool | next () |
virtual void | bindInt (unsigned int position, int value) |
virtual void | bindString (unsigned int position, const std::string &value) |
virtual void | reset () |
Public Member Functions inherited from RelationalDBQueryResult | |
virtual | ~RelationalDBQueryResult () |
virtual int | column (const std::string &name) const |
Private Attributes | |
sqlite3_stmt * | statement_ |
the compiled SQLite statement handle More... | |
SQLiteConnection * | connection_ |
sqlite connection handle More... | |
std::vector< std::string > | columnNames_ |
column names More... | |
std::vector< DataObject > | currentData_ |
data of the current row More... | |
std::vector< DataObject > | nextData_ |
data of the next row More... | |
bool | dataInitialized_ |
has next() been called for this query More... | |
Additional Inherited Members | |
Static Public Attributes inherited from RelationalDBQueryResult | |
static const int | UNKNOWN_INDEX = -1 |
Implementation of RelationalDBQueryResult interface for SQLite.
Definition at line 50 of file SQLiteQueryResult.hh.
SQLiteQueryResult::SQLiteQueryResult | ( | sqlite3_stmt * | statement, |
SQLiteConnection * | connection, | ||
bool | init = true |
||
) |
Constructor.
virtualMachine | Compiled SQLite virtual machine for the query. |
Definition at line 49 of file SQLiteQueryResult.cc.
References next().
|
virtual |
Destructor.
SQLite virtual machine is freed.
Definition at line 69 of file SQLiteQueryResult.cc.
References connection_, Exception::errorMessage(), SQLiteConnection::finalizeQuery(), statement_, and Application::writeToErrorLog().
|
virtual |
Binds int to sqlite statement at given position (1->)
Reimplemented from RelationalDBQueryResult.
Definition at line 215 of file SQLiteQueryResult.cc.
References connection_, statement_, and SQLiteConnection::throwIfSQLiteError().
|
virtual |
Binds string to sqlite statement at given position (1->)
Reimplemented from RelationalDBQueryResult.
Definition at line 223 of file SQLiteQueryResult.cc.
References connection_, statement_, and SQLiteConnection::throwIfSQLiteError().
|
virtual |
Returns the name (title) of a column in the result set.
columnIndex | Index of the column of which title interested. |
Reimplemented from RelationalDBQueryResult.
Definition at line 98 of file SQLiteQueryResult.cc.
References columnNames_.
|
virtual |
Returns the number of columns in the result set.
Reimplemented from RelationalDBQueryResult.
Definition at line 86 of file SQLiteQueryResult.cc.
References columnNames_.
|
virtual |
Returns the data of a column in the current row in the result set.
This implementation is just to silence Intel compiler's warnings about "partial implementation" of data() (because it's overriden function).
name | Name of the column of which data to return. |
Reimplemented from RelationalDBQueryResult.
Definition at line 135 of file SQLiteQueryResult.cc.
References RelationalDBQueryResult::data().
|
virtual |
Returns the data of a column in the current row in the result set.
columnIndex | Index of the column of which data to return. |
Implements RelationalDBQueryResult.
Definition at line 114 of file SQLiteQueryResult.cc.
References currentData_, and NullDataObject::instance().
Referenced by next().
|
virtual |
Queries if the result set contains more rows.
Implements RelationalDBQueryResult.
Definition at line 146 of file SQLiteQueryResult.cc.
References dataInitialized_, next(), and nextData_.
Referenced by next().
|
virtual |
Advances the row cursor to next row in the result set.
In case the current row is the last row this method does nothing but returns false.
Implements RelationalDBQueryResult.
Definition at line 162 of file SQLiteQueryResult.cc.
References assert, columnNames_, currentData_, data(), dataInitialized_, hasNext(), nextData_, DataObject::setNull(), DataObject::setString(), and statement_.
Referenced by hasNext(), and SQLiteQueryResult().
|
virtual |
Resets compiled sqlite statement for new bindings and execution.
Reimplemented from RelationalDBQueryResult.
Definition at line 232 of file SQLiteQueryResult.cc.
References columnNames_, connection_, currentData_, dataInitialized_, nextData_, statement_, and SQLiteConnection::throwIfSQLiteError().
|
private |
column names
Definition at line 74 of file SQLiteQueryResult.hh.
Referenced by columnName(), columns(), next(), and reset().
|
private |
sqlite connection handle
Definition at line 72 of file SQLiteQueryResult.hh.
Referenced by bindInt(), bindString(), reset(), and ~SQLiteQueryResult().
|
private |
data of the current row
Definition at line 76 of file SQLiteQueryResult.hh.
|
private |
|
private |
data of the next row
Definition at line 78 of file SQLiteQueryResult.hh.
|
private |
the compiled SQLite statement handle
Definition at line 70 of file SQLiteQueryResult.hh.
Referenced by bindInt(), bindString(), next(), reset(), and ~SQLiteQueryResult().