ledger-core
Public Member Functions | List of all members
Connection Class Reference
+ Inheritance diagram for Connection:
+ Collaboration diagram for Connection:

Public Member Functions

 Connection (sqlite3 *db, const std::string &dbName)
 
std::shared_ptr< api::DatabaseStatementprepareStatement (const std::string &query, bool repeatable) override
 
void begin () override
 
void rollback () override
 
void commit () override
 
void close () override
 
std::shared_ptr< api::DatabaseBlobnewBlob () override
 
void check_sqlite_err (sqlite3 *db, int result, const std::string &errorMessage)
 
void changePassword (const std::string &oldPassword, const std::string &newPassword)
 
void setPassword (const std::string &password)
 

Member Function Documentation

◆ begin()

void Connection::begin ( )
inlineoverridevirtual

Begin a SQL transaction on this connection.

Implements ledger::core::api::DatabaseConnection.

◆ close()

void Connection::close ( )
inlineoverridevirtual

Close the current connection. After this call the connection should never be called again.

Implements ledger::core::api::DatabaseConnection.

◆ commit()

void Connection::commit ( )
inlineoverridevirtual

End the current transaction and persist all changes that occurred between the call of begin and commit.

Implements ledger::core::api::DatabaseConnection.

◆ newBlob()

std::shared_ptr<api::DatabaseBlob> Connection::newBlob ( )
inlineoverridevirtual

Create a new empty blob.

Returns
An empty blob

Implements ledger::core::api::DatabaseConnection.

◆ prepareStatement()

std::shared_ptr<api::DatabaseStatement> Connection::prepareStatement ( const std::string &  query,
bool  repeatable 
)
inlineoverridevirtual

Prepare a statement object using the given SQL query. The statement object will then be responsible of executing the query and handle results. Statement objects may be reused over time if their repeatable flag is set to true.

Parameters
queryA SQL query to execute (e.g. "SELECT * FROM users WHERE name = 'Joe'")
repeatableA flag to indicate whether or not the statement is repeatable

Implements ledger::core::api::DatabaseConnection.

◆ rollback()

void Connection::rollback ( )
inlineoverridevirtual

End the current transaction and rollback all changes that occurred between the call of begin and rollback.

Implements ledger::core::api::DatabaseConnection.


The documentation for this class was generated from the following file: