ledger-core
Public Member Functions | List of all members
ledger::core::api::DatabaseConnection Class Referenceabstract

#include <DatabaseConnection.hpp>

+ Inheritance diagram for ledger::core::api::DatabaseConnection:

Public Member Functions

virtual std::shared_ptr< DatabaseStatementprepareStatement (const std::string &query, bool repeatable)=0
 
virtual void begin ()=0
 
virtual void rollback ()=0
 
virtual void commit ()=0
 
virtual void close ()=0
 
virtual std::shared_ptr< DatabaseBlobnewBlob ()=0
 

Detailed Description

An active connection to a database. This API is fully synchronous and all objects created by this interface need to return synchronously. A connection is used to prepare statements, managing transactions and creating abstractions of database objects.

Member Function Documentation

◆ begin()

virtual void ledger::core::api::DatabaseConnection::begin ( )
pure virtual

Begin a SQL transaction on this connection.

Implemented in Connection.

◆ close()

virtual void ledger::core::api::DatabaseConnection::close ( )
pure virtual

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

Implemented in Connection.

◆ commit()

virtual void ledger::core::api::DatabaseConnection::commit ( )
pure virtual

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

Implemented in Connection.

◆ newBlob()

virtual std::shared_ptr<DatabaseBlob> ledger::core::api::DatabaseConnection::newBlob ( )
pure virtual

Create a new empty blob.

Returns
An empty blob

Implemented in Connection.

◆ prepareStatement()

virtual std::shared_ptr<DatabaseStatement> ledger::core::api::DatabaseConnection::prepareStatement ( const std::string &  query,
bool  repeatable 
)
pure virtual

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

Implemented in Connection.

◆ rollback()

virtual void ledger::core::api::DatabaseConnection::rollback ( )
pure virtual

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

Implemented in Connection.


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