Class to access data of query results.
More...
#include <sl3/columns.hpp>
|
| Columns (Columns &&)=default |
| Move constructor A column is movable.
|
|
| ~Columns ()=default |
| Destructor.
|
|
int | count () const |
| Number of columns in the statement.
|
|
std::string | getName (int idx) const |
| Column name of given index.
|
|
std::vector< std::string > | getNames () const |
| Get columns names.
|
|
DbValue | getValue (int idx) const |
| Get the value at a given index.
|
|
DbValue | getValue (int idx, Type type) const |
| Get the value at a given index.
|
|
DbValues | getRow () const |
| Get all columns at once.
|
|
DbValues | getRow (const Types &types) const |
| Get all columns at once using the given types.
|
|
Type | getType (int idx) const |
| Get the sqlite type for a column.
|
|
size_t | getSize (int idx) const |
| Get the size of a column.
|
|
std::string | getText (int idx) const |
| Get the value of a column.
|
|
int | getInt (int idx) const |
| Get the value of a column.
|
|
int64_t | getInt64 (int idx) const |
| Get the value of a column.
|
|
double | getReal (int idx) const |
| Get the value of a column.
|
|
Blob | getBlob (int idx) const |
| Get the value of a column.
|
|
sqlite3_stmt * | get_stmt () const |
| Get the underlying sqlite3_stmt.
|
|
Class to access data of query results.
A Columns instance is constructed by a Command and passed to the callback which handles the results of a query.
- See also
- RowCallback
-
Command::Callback
-
Database::Callback
◆ Columns()
sl3::Columns::Columns |
( |
Columns && |
| ) |
|
|
default |
Move constructor A column is movable.
◆ ~Columns()
sl3::Columns::~Columns |
( |
| ) |
|
|
default |
◆ count()
int sl3::Columns::count |
( |
| ) |
const |
Number of columns in the statement.
- Returns
- number of columns
◆ get_stmt()
sqlite3_stmt * sl3::Columns::get_stmt |
( |
| ) |
const |
|
inline |
Get the underlying sqlite3_stmt.
User defined QueryCallbacks might have their own way to do things, so this getter provides access to the underlying sqlite3_stmt.
- Returns
- underlying sqlite3_stmt
◆ getBlob()
Blob sl3::Columns::getBlob |
( |
int |
idx | ) |
const |
Get the value of a column.
If a column is Null of of a different type, the sqlite3 conversion rules are applied.
- Parameters
-
- Exceptions
-
- Returns
- column value
◆ getInt()
int sl3::Columns::getInt |
( |
int |
idx | ) |
const |
Get the value of a column.
If a column is Null of of a different type, the sqlite3 conversion rules are applied.
- Parameters
-
- Exceptions
-
- Returns
- column value
◆ getInt64()
int64_t sl3::Columns::getInt64 |
( |
int |
idx | ) |
const |
Get the value of a column.
If a column is Null of of a different type, the sqlite3 conversion rules are applied.
- Parameters
-
- Exceptions
-
- Returns
- column value
◆ getName()
std::string sl3::Columns::getName |
( |
int |
idx | ) |
const |
Column name of given index.
- Exceptions
-
- Parameters
-
- Returns
- column name or an empty string if index is invalid
◆ getNames()
std::vector< std::string > sl3::Columns::getNames |
( |
| ) |
const |
Get columns names.
Will return a list of size count() . Unnamed columns will be an ampty string
- Returns
- the names
◆ getReal()
double sl3::Columns::getReal |
( |
int |
idx | ) |
const |
Get the value of a column.
If a column is Null of of a different type, the sqlite3 conversion rules are applied.
- Parameters
-
- Exceptions
-
- Returns
- column value
◆ getRow() [1/2]
◆ getRow() [2/2]
Get all columns at once using the given types.
If a value does not math the given types an exception will be thown
- Parameters
-
- Exceptions
-
- Returns
- DbValues of the column values
◆ getSize()
size_t sl3::Columns::getSize |
( |
int |
idx | ) |
const |
Get the size of a column.
The size sqlite3 uses to store the value of the given field.
- Parameters
-
- Exceptions
-
- Returns
- size sqlite uses for the column
◆ getText()
std::string sl3::Columns::getText |
( |
int |
idx | ) |
const |
Get the value of a column.
If a column is Null of of a different type, the sqlite3 conversion rules are applied.
- Parameters
-
- Exceptions
-
- Returns
- column value
◆ getType()
Type sl3::Columns::getType |
( |
int |
idx | ) |
const |
Get the sqlite type for a column.
If used, should be called before accessing the value of the column at the given index, otherwise the typed access might set the type.
This method can be used to check if a column isNull.
- Parameters
-
- Exceptions
-
- Returns
- Type sqlite interprets the value
◆ getValue() [1/2]
DbValue sl3::Columns::getValue |
( |
int |
idx | ) |
const |
Get the value at a given index.
The returned DbValue::getType() will be a Type::Variant and DbValue::getStorageType() will be set to the sqlite3 storage type.
- Parameters
-
- Exceptions
-
- Returns
- DbValue of requested column
◆ getValue() [2/2]
DbValue sl3::Columns::getValue |
( |
int |
idx, |
|
|
Type |
type |
|
) |
| const |
Get the value at a given index.
The returned DbValue::getType() and DbValue::getStorageType() will be set to the given type.
- Parameters
-
idx | wanted index |
type | wanted type |
- Exceptions
-
- Returns
- DbValue of requested column
The documentation for this class was generated from the following file: