Manages the SQLite database connection and transaction lifecycle.
More...
#include <database_connection.h>
|
| std::unique_ptr< sqlite3, decltype(&sqlite3_close)> | db |
| |
Manages the SQLite database connection and transaction lifecycle.
This class provides a safe RAII wrapper around the raw sqlite3 connection and offers transactional boundaries and statement execution functions.
◆ DatabaseConnection()
| DatabaseConnection::DatabaseConnection |
( |
const std::string & |
db_path | ) |
|
|
explicit |
Constructs a new DatabaseConnection.
- Parameters
-
| db_path | The path to the SQLite database file. |
◆ ~DatabaseConnection()
| DatabaseConnection::~DatabaseConnection |
( |
| ) |
|
|
default |
◆ beginTransaction()
| void DatabaseConnection::beginTransaction |
( |
| ) |
const |
Begins a new SQLite transaction.
◆ commitTransaction()
| void DatabaseConnection::commitTransaction |
( |
| ) |
const |
Commits the current SQLite transaction.
◆ executeStep()
| void DatabaseConnection::executeStep |
( |
sqlite3_stmt * |
stmt | ) |
const |
◆ getRaw()
| sqlite3 * DatabaseConnection::getRaw |
( |
| ) |
const |
|
inline |
Access the raw sqlite3 connection object.
- Returns
- A pointer to the raw sqlite3 object.
◆ initialize()
| void DatabaseConnection::initialize |
( |
| ) |
const |
Initializes the database schema.
◆ loadSQLFiles()
| void DatabaseConnection::loadSQLFiles |
( |
| ) |
const |
|
private |
◆ prepareStatement()
| sqlite3_stmt * DatabaseConnection::prepareStatement |
( |
const std::string & |
sql | ) |
const |
◆ rollbackTransaction()
| void DatabaseConnection::rollbackTransaction |
( |
| ) |
const |
Rolls back the current SQLite transaction.
◆ db
| std::unique_ptr<sqlite3, decltype(&sqlite3_close)> DatabaseConnection::db |
|
private |
Initial value:{nullptr,
&sqlite3_close}
The documentation for this class was generated from the following files: