|
HFSQtLi 0.0.1
A Qt/C++ wrapper for SQLite3.
|
This section describes the data types that are handled by the fetching functions (e.g. Query::step, Db::executeSingle, ...). Fetching a data type comes in two flavors: standard and strict. The strict mode checks for the type and range of retrived column to be compatible before fetching the data. If anything does not match an error will be returned by the corresponding call. The standard mode on the other hand just calls the API of the requested column type without performings any checks.
Following types are directly mapped to sqlite_column_X calls
The following types are handled natively:
If retriving in strict mode the retrived column is checked to be of integer type and the range of the destination type is checked (e.g. fetching 129 in a qint8 will give an error).
Note: as SQLite stores only 64 bit signed integers the results of operations on 64 bit unsigned with the most signficant bit set is undefined
The following types are handled natively:
In strict mode the column is checked to be a floating point. Also the float version checks that absolute value of retrived column is not between float_max and infinite (not inclusive)
The following types are handled natively:
Text and blob data can be read respectively with QString and QByteArray
If the fetched column is NULL the result is cleared, othewise the value will be read as if the type T was read diredtly.
If the fetched data is a tuple then the data is retrived as if each element of the tuple was retrived consecutevely.
E.g.
is equivalent to
Passing an Unused<N> parameters will consume N columns without fetching any data. No error will be returned except for checking the number of fetched columns.
Passing a Call<T...>(f) parameter allows fetching data of type T... and call the corresponding function after the data is fetched.
Passing a Blob to a column will behave differently depending on the column type.
It is possible to handle the fetching of any data type T by implementing a function
void customFetch(CustomFetch &fetch, T &data)
This function will have to use the passed accessor to retrive the needed column(s) and set data