|
libsl3 1.3.51003
A C++ interface for SQLite
|
A utility for processing query results. More...
#include <sl3/dataset.hpp>
Public Types | |
| typedef bool(* | DbValueSort) (const DbValue &, const DbValue &) |
| Typedef for a relation function signature. | |
| Public Types inherited from sl3::Container< std::vector< DbValues > > | |
| using | container_type |
| using | iterator |
| using | const_iterator |
| using | value_type |
| using | reference |
| using | const_reference |
| using | size_type |
Public Member Functions | |
| Dataset () noexcept | |
| Constructor. | |
| Dataset (Types types) | |
| Constructor with DbValuesTypeList as description. | |
| Dataset (const Dataset &)=default | |
| Copy Constructor. | |
| Dataset (Dataset &&) noexcept(std::is_nothrow_move_constructible< Container< DbValues > >::value &&std::is_nothrow_move_constructible< Types >::value &&std::is_nothrow_move_constructible< std::vector< std::string > >::value) | |
| Move Constructor. | |
| Dataset & | operator= (const Dataset &)=default |
| Value assignment. | |
| Dataset & | operator= (Dataset &&)=default |
| Rvalue assignment. | |
| void | reset () |
| Clear all states. Removes loaded data so that the actual instance can be reused/refilled. | |
| void | reset (const Types &types) |
| Clear all states. | |
| void | merge (const Dataset &other) |
| Merge another Dataset. | |
| void | merge (const DbValues &row) |
| Merge DbValues. | |
| std::size_t | getIndex (const std::string &name) const |
| Get the index of a field by name. | |
| void | sort (const std::vector< size_t > &idxs, DbValueSort cmp=&dbval_lt) |
| Sort the Dataset. | |
| Public Member Functions inherited from sl3::Container< std::vector< DbValues > > | |
| Container () noexcept | |
| Constructor. | |
| Container & | operator= (const Container &)=default |
| Assignment. | |
| virtual | ~Container () noexcept(std::is_nothrow_destructible< std::vector< DbValues > >::value)=default |
| Destructor. | |
| iterator | begin () |
| Iterator access. | |
| iterator | end () |
| Iterator access. | |
| const_iterator | cbegin () const |
| Iterator access. | |
| const_iterator | cend () const |
| Iterator access. | |
| size_type | size () const |
| Container size. | |
| reference | at (size_t i) |
| checked random access | |
| reference | operator[] (size_t i) |
| unchecked random access | |
Additional Inherited Members | |
| Protected Attributes inherited from sl3::Container< std::vector< DbValues > > | |
| std::vector< DbValues > | _cont |
| Container T. | |
A utility for processing query results.
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:
Typedef for a relation function signature.
Used to specify the less function that shall be used for sorting
a 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.
| sl3::Dataset::Dataset | ( | Types | types | ) |
|
default |
Copy Constructor.
|
noexcept |
Move Constructor.
| std::size_t sl3::Dataset::getIndex | ( | const std::string & | name | ) | const |
Get the index of a field by name.
| sl3::OutOfRange | if name is not found |
| name | field name |
| void sl3::Dataset::merge | ( | const Dataset & | other | ) |
Merge another 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 current one.
| sl3::ErrTypeMisMatch | if field names types are not equal or size differs. |
| other | Dataset which shall be added to this one. |
| void sl3::Dataset::merge | ( | const DbValues & | row | ) |
Merge DbValues.
Appends the DbValues to the end of the actual data.
| sl3::ErrTypeMisMatch | if size differs from existing row size or if types are not compatible |
| row | A row which shall be added. |
Value assignment.
Rvalue assignment.
| void sl3::Dataset::reset | ( | ) |
Clear all states. Removes loaded data so that the actual instance can be reused/refilled.
| 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 to populate with a different select statement / SQL command. Passing an empty DbValuesTypeList means that all fields will be DsVariantField and field count will be detected.
| types | new Types requirement |
| void sl3::Dataset::sort | ( | const std::vector< size_t > & | idxs, |
| DbValueSort | cmp = &dbval_lt ) |
Sort the Dataset.
Sort according to the given field indexes. The Dataset will be sorted according to sqlite rules.
| sl3::OutOfRange | if a given index is invalid |
| idxs | list of field indexes |
| cmp | pointer to a less than compare function, default dbval_lt |