q4wine's SQLite3 engine warper. This class provides basic common SQL workflow, like making SQL queries, retrieving and inserting data.
More...
#include <q4wine/src/lib/db.hpp>
|
bool | open (std::string name) |
| Open SQLite database. More...
|
|
bool | init (void) |
| Itialize database. Create tables and default bootsrap data on first startup. More...
|
|
bool | exec (const std::string &sql_s) const |
| Execute raw SQL statement. Use this fuction to call raw SQL statements. If you need to bind values, use overloaded function. More...
|
|
bool | exec (const std::string &sql_s, const std::initializer_list< std::string > &args) const |
| Prepare and execute SQL statement with provided arguments. More...
|
|
rows | select (const std::string &sql_s) const |
| Execute raw SQL statement and return the result. More...
|
|
rows | select (const std::string &sql_s, const std::initializer_list< std::string > &args) const |
| Prepare and execute SQL statement with provided arguments and return the result. More...
|
|
result | select_one (const std::string &sql_s) const |
| select Execute raw SQL statement and return the single result More...
|
|
result | select_one (const std::string &sql_s, const std::initializer_list< std::string > &args) const |
| Prepare and execute SQL statement with provided arguments and return the single result. More...
|
|
intptr_t | get_id (void) const |
| Get last insert rowid. More...
|
|
bool | is_open (void) const |
| Check if database already open. More...
|
|
void | close (void) const |
| Close database. Call this on app shutdown. More...
|
|
q4wine::lib::DBEngine::DBEngine |
( |
DBEngine const & |
| ) |
|
|
protecteddelete |
q4wine::lib::DBEngine::DBEngine |
( |
| ) |
|
|
protected |
q4wine::lib::DBEngine::~DBEngine |
( |
| ) |
|
|
protected |
void q4wine::lib::DBEngine::close |
( |
void |
| ) |
const |
bool q4wine::lib::DBEngine::exec |
( |
const std::string & |
sql_s | ) |
const |
- See also
- exec
- Parameters
-
- Returns
- True on success.
bool q4wine::lib::DBEngine::exec |
( |
const std::string & |
sql_s, |
|
|
const std::initializer_list< std::string > & |
args |
|
) |
| const |
- Parameters
-
sql_s | Raw SQL string. |
args | A list of values to bound. |
- Returns
- True on success.
intptr_t q4wine::lib::DBEngine::get_id |
( |
void |
| ) |
const |
DBEngine * q4wine::lib::DBEngine::getInstance |
( |
| ) |
|
|
static |
bool q4wine::lib::DBEngine::init |
( |
void |
| ) |
|
bool q4wine::lib::DBEngine::is_open |
( |
void |
| ) |
const |
- Returns
- True if db is open.
bool q4wine::lib::DBEngine::open |
( |
std::string |
name | ) |
|
- Parameters
-
name | A URI file name. The path component of the URI specifies the disk file that is the SQLite database to be opened. If the path component is omitted, then the database is stored in a temporary file that will be automatically deleted when the database connection closes. |
- Returns
- True on success
rows q4wine::lib::DBEngine::select |
( |
const std::string & |
sql_s | ) |
const |
- Parameters
-
- Returns
- Return a map of rows
- See also
- rows.
rows q4wine::lib::DBEngine::select |
( |
const std::string & |
sql_s, |
|
|
const std::initializer_list< std::string > & |
args |
|
) |
| const |
- Parameters
-
sql_s | Raw SQL string. |
args | A list of values to bound. |
- Returns
- A map of rows
- See also
- rows.
result q4wine::lib::DBEngine::select_one |
( |
const std::string & |
sql_s | ) |
const |
- Note
- You don't need to specify SQL LIMIT command, this function will add it by default.
- Parameters
-
- Returns
- Return single result
- See also
- result.
result q4wine::lib::DBEngine::select_one |
( |
const std::string & |
sql_s, |
|
|
const std::initializer_list< std::string > & |
args |
|
) |
| const |
- Note
- You don't need to specify SQL LIMIT command, this function will add it by default.
- Parameters
-
sql_s | Raw SQL string. |
args | A list of values to bound. |
- Returns
- Return single result
- See also
- result.
DBEngine * q4wine::lib::DBEngine::DBEngine_instance |
|
staticprotected |
The documentation for this class was generated from the following files: