sqlite3_database_unique_ptr class
Unique pointer for sqlite3 databases, which automatically closes the database when the pointer goes out of scope or is reset.
Contents
- Reference
Public functions
- auto errorMessage() const -> QString
- Returns the most recent error message encountered by the database.
- auto exec(const QString& sql, QString& errorMessage) const -> int
- Executes the sql command in the database.
- auto open(const QString& path) -> int
- Opens the database at the specified file path.
- auto open_v2(const QString& path, int flags, const char* zVfs) -> int
- Opens the database at the specified file path.
-
auto prepare(const QString& sql,
int& resultCode) const -> sqlite3_
statement_ unique_ ptr - Prepares a sql statement, returning the result.
Function documentation
int sqlite3_ database_ unique_ ptr:: exec(const QString& sql,
QString& errorMessage) const
Executes the sql command in the database.
Multiple sql queries can be run within one single command. Errors are reported to errorMessage. Returns SQLITE_OK in case of success or an sqlite error code.
int sqlite3_ database_ unique_ ptr:: open(const QString& path)
Opens the database at the specified file path.
Returns the sqlite error code, or SQLITE_OK if open was successful.
int sqlite3_ database_ unique_ ptr:: open_v2(const QString& path,
int flags,
const char* zVfs)
Opens the database at the specified file path.
Returns the sqlite error code, or SQLITE_OK if open was successful.
sqlite3_ statement_ unique_ ptr sqlite3_ database_ unique_ ptr:: prepare(const QString& sql,
int& resultCode) const
Prepares a sql statement, returning the result.
The resultCode argument will be filled with the sqlite3 result code.