A utility for processing the result queries.
More...
#include <sl3/dataset.hpp>
|
typedef bool(* | DbValueSort) (const DbValue &, const DbValue &) |
| Typedef for a relation function signature.
|
|
using | conatiner_type = std::vector< DbValues > |
|
using | iterator = typename conatiner_type::iterator |
|
using | const_iterator = typename conatiner_type::const_iterator |
|
using | value_type = typename conatiner_type::value_type |
|
using | reference = typename conatiner_type::reference |
|
using | const_reference = typename conatiner_type::const_reference |
|
using | size_type = typename conatiner_type::size_type |
|
using | container_type = std::vector< DbValues > |
|
A utility for processing the result queries.
This class is a RowCallback that loads the result of a Query into a list of DbValues. The loaded list can be browsed and the loaded values can be accessed.
A Dataset can either be created:
- giving a DbValuesTypeList that describes the fields
Giving a DbValuesTypeList the types of DbValue will use the given storage type when reading the data from sqlite.
When the Dataset becomes populated with data the field count will be validated. In case the number of fields is different sl3::ErrTypeMisMatch will be thrown.
- Without any specification
In this case all fields will be DsVariantField , using the storage type sqlite reports for the actual value.
◆ DbValueSort
typedef bool(* sl3::Dataset::DbValueSort) (const DbValue &, const DbValue &) |
Typedef for a relation function signature.
Used to specify the the less function that shall be used for sorting a Dataset.
- See also
- Dataset::sort
◆ Dataset() [1/4]
sl3::Dataset::Dataset |
( |
| ) |
|
|
noexcept |
Constructor.
All fields will be DsVariantField , using the storage type sqlite reports for the actual value. Field count will be detected and applied.
◆ Dataset() [2/4]
sl3::Dataset::Dataset |
( |
Types |
types | ) |
|
Constructor wiht DbValuesTypeList as description.
Types of DbValue will use the given description when creating the DbValue list. If the given list is not empty, field count will be validated when the actual instance becomes populated with data.
- Parameters
-
types | Types the fields must satisfy |
◆ Dataset() [3/4]
sl3::Dataset::Dataset |
( |
const Dataset & |
| ) |
|
|
default |
◆ Dataset() [4/4]
sl3::Dataset::Dataset |
( |
Dataset && |
| ) |
const && |
|
noexcept |
◆ getIndex()
std::size_t sl3::Dataset::getIndex |
( |
const std::string & |
name | ) |
const |
Get the index of a field by namespace.
- Exceptions
-
sl3::OutOfRanage | if name is not found |
- Parameters
-
- Returns
- field index
◆ merge() [1/2]
void sl3::Dataset::merge |
( |
const Dataset & |
other | ) |
|
Merge an other Dataset.
Appends the data of the given Dataset to the end of the actual data. The field names and types of the given Dataset must match the actuals one.
- Exceptions
-
- Parameters
-
other | Dataset which shall be added to this one. |
◆ merge() [2/2]
void sl3::Dataset::merge |
( |
const DbValues & |
row | ) |
|
Merge DbValues.
Appends the DbValues to the end of the actual data.
- Exceptions
-
- Parameters
-
row | A row which shall be added. |
◆ operator=() [1/2]
Value assignment.
- Returns
- reference to this
◆ operator=() [2/2]
Rvalues assignment.
- Returns
- reference to this
◆ reset() [1/2]
void sl3::Dataset::reset |
( |
| ) |
|
Clear all states. Removes loaded data so that the actual instance can be reused/refilled.
◆ reset() [2/2]
void sl3::Dataset::reset |
( |
const Types & |
types | ) |
|
Clear all states.
Removes loaded data and sets a new specification for the field description so that the actual instance can be reused for populate with a different select statement / sql command. Passing an empty DbValuesTypeList mean that all fields will be DsVariandField and field count will be detected.
- Parameters
-
types | new Types requirement |
◆ sort()
Sort the Dataset.
Sort according to the given field indexes. The Dataset will be sorted according to sqlite rules.
- Exceptions
-
sl2::OutOfRange | if a given index is invalid |
- Parameters
-
idxs | list of field indexes |
cmp | pointer to a less than compare function, default dbval_lt |
The documentation for this class was generated from the following file: