Kea 2.7.5
isc::db::PgSqlConnection Class Reference

Common PgSql Connector Pool. More...

#include <pgsql_connection.h>

+ Inheritance diagram for isc::db::PgSqlConnection:

Public Types

typedef std::function< void(PgSqlResult &, int) ConsumeResultRowFun)
 Function invoked to process fetched row.
 
- Public Types inherited from isc::db::DatabaseConnection
typedef std::map< std::string, std::string > ParameterMap
 Database configuration parameter map.
 

Public Member Functions

 PgSqlConnection (const ParameterMap &parameters, IOServiceAccessorPtr io_accessor=IOServiceAccessorPtr(), DbCallback callback=DbCallback())
 Constructor.
 
virtual ~PgSqlConnection ()
 Destructor.
 
void checkStatementError (const PgSqlResult &r, PgSqlTaggedStatement &statement)
 Checks result of the r object.
 
void commit ()
 Commits current transaction.
 
bool compareError (const PgSqlResult &r, const char *error_state)
 Checks a result set's SQL state against an error state.
 
void createSavepoint (const std::string &name)
 Creates a savepoint within the current transaction.
 
PgSqlResultPtr executePreparedStatement (PgSqlTaggedStatement &statement, const PsqlBindArray &in_bindings=PsqlBindArray())
 Executes a prepared SQL statement.
 
void executeSQL (const std::string &sql)
 Executes the an SQL statement.
 
std::string getConnParameters ()
 Creates connection string from specified parameters.
 
void insertQuery (PgSqlTaggedStatement &statement, const PsqlBindArray &in_bindings)
 Executes INSERT prepared statement.
 
bool isTransactionStarted () const
 Checks if there is a transaction in progress.
 
void openDatabase ()
 Open database with logging.
 
 operator bool () const
 Boolean Operator.
 
 operator PGconn * () const
 Conversion Operator.
 
void prepareStatement (const PgSqlTaggedStatement &statement)
 Prepare Single Statement.
 
void prepareStatements (const PgSqlTaggedStatement *start_statement, const PgSqlTaggedStatement *end_statement)
 Prepare statements.
 
void rollback ()
 Rollbacks current transaction.
 
void rollbackToSavepoint (const std::string &name)
 Rollbacks to the given savepoint.
 
void selectQuery (PgSqlTaggedStatement &statement, const PsqlBindArray &in_bindings, ConsumeResultRowFun process_result_row)
 Executes SELECT query using prepared statement.
 
void startRecoverDbConnection ()
 The recover connection.
 
void startTransaction ()
 Starts new transaction.
 
uint64_t updateDeleteQuery (PgSqlTaggedStatement &statement, const PsqlBindArray &in_bindings)
 Executes UPDATE or DELETE prepared statement and returns the number of affected rows.
 
- Public Member Functions inherited from isc::db::DatabaseConnection
 DatabaseConnection (const ParameterMap &parameters, DbCallback callback=DbCallback())
 Constructor.
 
virtual ~DatabaseConnection ()
 Destructor.
 
void checkUnusable ()
 Throws an exception if the connection is not usable.
 
bool configuredReadOnly () const
 Convenience method checking if database should be opened with read only access.
 
std::string getParameter (const std::string &name) const
 Returns value of a connection parameter.
 
bool isUnusable ()
 Flag which indicates if connection is unusable.
 
virtual void makeReconnectCtl (const std::string &timer_name)
 Instantiates a ReconnectCtl based on the connection's reconnect parameters.
 
util::ReconnectCtlPtr reconnectCtl ()
 The reconnect settings.
 

Static Public Member Functions

static void ensureSchemaVersion (const ParameterMap &parameters, const DbCallback &cb=DbCallback(), const std::string &timer_name=std::string())
 Retrieve schema version, validate it against the hardcoded version, and attempt to initialize the schema if there is an error during retrieval.
 
static std::pair< uint32_t, uint32_t > getVersion (const ParameterMap &parameters, const IOServiceAccessorPtr &ac=IOServiceAccessorPtr(), const DbCallback &cb=DbCallback(), const std::string &timer_name=std::string())
 Get the schema version.
 
static void initializeSchema (const ParameterMap &parameters)
 Initialize schema.
 
static std::tuple< std::vector< std::string >, std::vector< std::string > > toKeaAdminParameters (ParameterMap const &params)
 Convert PostgreSQL library parameters to kea-admin parameters.
 
- Static Public Member Functions inherited from isc::db::DatabaseConnection
static isc::asiolink::IOServicePtrgetIOService ()
 Returns pointer to the IO service.
 
static bool invokeDbFailedCallback (const util::ReconnectCtlPtr &db_reconnect_ctl)
 Invokes the connection's restore failed connectivity callback.
 
static bool invokeDbLostCallback (const util::ReconnectCtlPtr &db_reconnect_ctl)
 Invokes the connection's lost connectivity callback.
 
static bool invokeDbRecoveredCallback (const util::ReconnectCtlPtr &db_reconnect_ctl)
 Invokes the connection's restored connectivity callback.
 
static ParameterMap parse (const std::string &dbaccess)
 Parse database access string.
 
static std::string redactedAccessString (const ParameterMap &parameters)
 Redact database access string.
 
static void setIOService (const isc::asiolink::IOServicePtr &io_service)
 Sets IO service to be used by the database backends.
 
static isc::data::ElementPtr toElement (const ParameterMap &params)
 Unparse a parameter map.
 
static isc::data::ElementPtr toElementDbAccessString (const std::string &dbaccess)
 Unparse an access string.
 

Public Attributes

PgSqlHolder conn_
 PgSql connection handle.
 
isc::asiolink::IOServicePtr io_service_
 IOService object, used for all ASIO operations.
 
IOServiceAccessorPtr io_service_accessor_
 Accessor function which returns the IOService that can be used to recover the connection.
 
int transaction_ref_count_
 Reference counter for transactions.
 

Static Public Attributes

static const char DUPLICATE_KEY [] = ERRCODE_UNIQUE_VIOLATION
 Define the PgSql error state for a duplicate key error.
 
static std::string KEA_ADMIN_ = KEA_ADMIN
 Holds location to kea-admin.
 
static const char NULL_KEY [] = ERRCODE_NOT_NULL_VIOLATION
 Define the PgSql error state for a null foreign key error.
 
static bool warned_about_tls = false
 Emit the TLS support warning only once.
 
- Static Public Attributes inherited from isc::db::DatabaseConnection
static DbCallback db_failed_callback_ = 0
 Optional callback function to invoke if an opened connection recovery failed.
 
static DbCallback db_lost_callback_ = 0
 Optional callback function to invoke if an opened connection is lost.
 
static DbCallback db_recovered_callback_ = 0
 Optional callback function to invoke if an opened connection recovery succeeded.
 
static const time_t MAX_DB_TIME = 2147483647
 Defines maximum value for time that can be reliably stored.
 
static bool retry_ = false
 Flag which indicates if the database connection should be retried on fail.
 
static bool test_mode_ = false
 Test mode flag (default false).
 

Additional Inherited Members

- Protected Member Functions inherited from isc::db::DatabaseConnection
void markUnusable ()
 Sets the unusable flag to true.
 
- Protected Attributes inherited from isc::db::DatabaseConnection
DbCallback callback_
 The callback used to recover the connection.
 

Detailed Description

Common PgSql Connector Pool.

This class provides common operations for PgSql database connection used by both PgSqlLeaseMgr and PgSqlHostDataSource. It manages connecting to the database and preparing compiled statements. Its fields are public, because they are used (both set and retrieved) in classes that use instances of PgSqlConnection.

Definition at line 198 of file pgsql_connection.h.

Member Typedef Documentation

◆ ConsumeResultRowFun

typedef std::function<void(PgSqlResult&, int) isc::db::PgSqlConnection::ConsumeResultRowFun)

Function invoked to process fetched row.

Definition at line 206 of file pgsql_connection.h.

Constructor & Destructor Documentation

◆ PgSqlConnection()

isc::db::PgSqlConnection::PgSqlConnection ( const ParameterMap & parameters,
IOServiceAccessorPtr io_accessor = IOServiceAccessorPtr(),
DbCallback callback = DbCallback() )
inline

Constructor.

Initialize PgSqlConnection object with parameters needed for connection.

Parameters
parametersSpecify the connection details.
io_accessorThe IOService accessor function.
callbackThe connection recovery callback.

Definition at line 218 of file pgsql_connection.h.

◆ ~PgSqlConnection()

isc::db::PgSqlConnection::~PgSqlConnection ( )
virtual

Destructor.

Definition at line 132 of file pgsql_connection.cc.

References isc::db::DB_LOG< log_type >::arg(), conn_, and isc::db::PGSQL_DEALLOC_ERROR.

+ Here is the call graph for this function:

Member Function Documentation

◆ checkStatementError()

void isc::db::PgSqlConnection::checkStatementError ( const PgSqlResult & r,
PgSqlTaggedStatement & statement )

Checks result of the r object.

This function is used to determine whether or not the SQL statement execution succeeded, and in the event of failures, decide whether or not the failures are recoverable.

If the error is recoverable, the function will throw a DbOperationError. If the error is deemed unrecoverable, such as a loss of connectivity with the server, the function will call startRecoverDbConnection() which will start the connection recovery.

If the invocation returns true, this indicates the calling layer will attempt recovery, and the function throws a DbOperationError to allow the caller to error handle the failed db access attempt.

Parameters
rresult of the last PostgreSQL operation
statement- tagged statement that was executed
Exceptions
isc::db::DbOperationErrorDetailed PostgreSQL failure

Definition at line 458 of file pgsql_connection.cc.

References isc::db::DB_LOG< log_type >::arg(), compareError(), conn_, DUPLICATE_KEY, isc_throw, isc::db::DatabaseConnection::markUnusable(), NULL_KEY, isc::db::PGSQL_FATAL_ERROR, and startRecoverDbConnection().

Referenced by executePreparedStatement(), and executeSQL().

+ Here is the call graph for this function:

◆ commit()

void isc::db::PgSqlConnection::commit ( )

Commits current transaction.

Commits all pending database operations. On databases that don't support transactions, this is a no-op.

When this method is called for a nested transaction it decrements the transaction reference counter incremented during the call to startTransaction.

Exceptions
DbOperationErrorIf the commit failed.

Definition at line 534 of file pgsql_connection.cc.

References isc::db::DatabaseConnection::checkUnusable(), conn_, isc::db::DB_DBG_TRACE_DETAIL, isc_throw, isc::db::PGSQL_COMMIT, and transaction_ref_count_.

Referenced by isc::db::PgSqlTransaction::commit().

+ Here is the call graph for this function:

◆ compareError()

bool isc::db::PgSqlConnection::compareError ( const PgSqlResult & r,
const char * error_state )

Checks a result set's SQL state against an error state.

Parameters
rresult set to check
error_stateerror state to compare against
Returns
True if the result set's SQL state equals the error_state, false otherwise.

Definition at line 450 of file pgsql_connection.cc.

References PGSQL_STATECODE_LEN.

Referenced by checkStatementError().

◆ createSavepoint()

void isc::db::PgSqlConnection::createSavepoint ( const std::string & name)

Creates a savepoint within the current transaction.

Creates a named savepoint within the current transaction.

Parameters
namename of the savepoint to create.
Exceptions
InvalidOperationif called outside a transaction.
DbOperationErrorIf the savepoint cannot be created.

Definition at line 574 of file pgsql_connection.cc.

References isc::db::DB_LOG< log_type >::arg(), isc::db::DB_DBG_TRACE_DETAIL, executeSQL(), isc_throw, isc::db::PGSQL_CREATE_SAVEPOINT, and transaction_ref_count_.

+ Here is the call graph for this function:

◆ ensureSchemaVersion()

void isc::db::PgSqlConnection::ensureSchemaVersion ( const ParameterMap & parameters,
const DbCallback & cb = DbCallback(),
const std::string & timer_name = std::string() )
static

Retrieve schema version, validate it against the hardcoded version, and attempt to initialize the schema if there is an error during retrieval.

Properly handles retrying of the database connection.

Parameters
parametersA data structure relating keywords and values concerned with the database.
cbThe dbReconnect callback.
timer_nameThe DB reconnect timer name.
Exceptions
isc::db::ScehamInitializationFailedif the initialization fails

Definition at line 178 of file pgsql_connection.cc.

References isc::db::DatabaseConnection::getIOService(), getVersion(), initializeSchema(), isc_throw, isc::db::PGSQL_SCHEMA_VERSION_MAJOR, isc::db::PGSQL_SCHEMA_VERSION_MINOR, and isc::db::DatabaseConnection::test_mode_.

+ Here is the call graph for this function:

◆ executePreparedStatement()

PgSqlResultPtr isc::db::PgSqlConnection::executePreparedStatement ( PgSqlTaggedStatement & statement,
const PsqlBindArray & in_bindings = PsqlBindArray() )

Executes a prepared SQL statement.

It executes the given prepared SQL statement, after checking for usability and input parameter sanity. After the statement is executed checkStatementError() is invoked to ensure we detect connectivity issues properly. Upon successful execution, the the result set is returned. It may be used for any form of prepared SQL statement (e.g query, insert, update, delete...), with or without input parameters.

Parameters
statementPgSqlTaggedStatement describing the prepared statement to execute.
in_bindingsarray of input parameter bindings. If the SQL statement requires no input arguments, this parameter should either be omitted or an empty PsqlBindArray should be supplied.
Exceptions
InvalidOperationif the number of parameters expected by the statement does not match the size of the input bind array.

Definition at line 605 of file pgsql_connection.cc.

References checkStatementError(), isc::db::DatabaseConnection::checkUnusable(), conn_, and isc_throw.

Referenced by insertQuery(), selectQuery(), and updateDeleteQuery().

+ Here is the call graph for this function:

◆ executeSQL()

void isc::db::PgSqlConnection::executeSQL ( const std::string & sql)

Executes the an SQL statement.

It executes the given SQL text after first checking the connection for usability. After the statement is executed checkStatementError() is invoked to ensure we detect connectivity issues properly. It is intended to be used to execute utility statements such as commit, rollback et al, which have no parameters, return no results, and are not pre-compiled.

Parameters
sqlSQL statement to execute.

Definition at line 595 of file pgsql_connection.cc.

References checkStatementError(), isc::db::DatabaseConnection::checkUnusable(), conn_, and isc::db::OID_NONE.

Referenced by createSavepoint(), and rollbackToSavepoint().

+ Here is the call graph for this function:

◆ getConnParameters()

std::string isc::db::PgSqlConnection::getConnParameters ( )

Creates connection string from specified parameters.

This function is called from the unit tests.

Returns
connection string for openDatabase.
Exceptions
NoDatabaseNameMandatory database name not given
DbInvalidTimeoutwhen the database timeout is wrong.

Definition at line 314 of file pgsql_connection.cc.

◆ getVersion()

std::pair< uint32_t, uint32_t > isc::db::PgSqlConnection::getVersion ( const ParameterMap & parameters,
const IOServiceAccessorPtr & ac = IOServiceAccessorPtr(),
const DbCallback & cb = DbCallback(),
const std::string & timer_name = std::string() )
static

Get the schema version.

Parameters
parametersA data structure relating keywords and values concerned with the database.
acAn IOServiceAccessor object.
cbThe dbReconnect callback.
timer_nameThe DB reconnect timer name.
Returns
Version number as a pair of unsigned integers. "first" is the major version number, "second" the minor number.
Exceptions
isc::db::DbOperationErrorAn operation on the open database has failed.

Definition at line 147 of file pgsql_connection.cc.

References isc::db::PgSqlExchange::getColumnValue(), isc_throw, and version().

Referenced by ensureSchemaVersion().

+ Here is the call graph for this function:

◆ initializeSchema()

void isc::db::PgSqlConnection::initializeSchema ( const ParameterMap & parameters)
static

Initialize schema.

Parameters
parametersA data structure relating keywords and values concerned with the database.
Exceptions
isc::db::ScehamInitializationFailedif the initialization fails

Definition at line 224 of file pgsql_connection.cc.

References isc::db::DB_LOG< log_type >::arg(), isc_throw, isc::util::file::isFile(), KEA_ADMIN_, isc::db::PGSQL_INITIALIZE_SCHEMA, isc::asiolink::ProcessSpawn::SYNC, and toKeaAdminParameters().

Referenced by ensureSchemaVersion().

+ Here is the call graph for this function:

◆ insertQuery()

void isc::db::PgSqlConnection::insertQuery ( PgSqlTaggedStatement & statement,
const PsqlBindArray & in_bindings )

Executes INSERT prepared statement.

The statement must refer to an existing prepared statement associated with the connection. The in_bindings size must match the number of placeholders in the prepared statement.

This method executes prepared statement using provided bindings to insert data into the database.

Parameters
statementreference to the precompiled tagged statement to execute
in_bindingsinput bindings holding values to substitue placeholders in the query.

Definition at line 656 of file pgsql_connection.cc.

References executePreparedStatement().

+ Here is the call graph for this function:

◆ isTransactionStarted()

bool isc::db::PgSqlConnection::isTransactionStarted ( ) const

Checks if there is a transaction in progress.

Returns
true if a transaction has been started, false otherwise.

Definition at line 529 of file pgsql_connection.cc.

References transaction_ref_count_.

◆ openDatabase()

void isc::db::PgSqlConnection::openDatabase ( )

Open database with logging.

Opens the database using the information supplied in the parameters passed to the constructor. It logs warnings resulting from the getConnParameters.

Exceptions
NoDatabaseNameMandatory database name not given
DbOpenErrorError opening the database

Definition at line 408 of file pgsql_connection.cc.

◆ operator bool()

isc::db::PgSqlConnection::operator bool ( ) const
inline

Boolean Operator.

Allows testing the PgConnection for initialized connection

Definition at line 586 of file pgsql_connection.h.

References conn_.

◆ operator PGconn *()

isc::db::PgSqlConnection::operator PGconn * ( ) const
inline

Conversion Operator.

Allows the PgConnection object to be passed as the context argument to PQxxxx functions.

Definition at line 579 of file pgsql_connection.h.

References conn_.

◆ prepareStatement()

void isc::db::PgSqlConnection::prepareStatement ( const PgSqlTaggedStatement & statement)

Prepare Single Statement.

Creates a prepared statement from the text given and adds it to the statements_ vector at the given index.

Parameters
statementSQL statement to be prepared.
Exceptions
isc::db::DbOperationErrorAn operation on the open database has failed.

Definition at line 291 of file pgsql_connection.cc.

References conn_, and isc_throw.

Referenced by prepareStatements().

◆ prepareStatements()

void isc::db::PgSqlConnection::prepareStatements ( const PgSqlTaggedStatement * start_statement,
const PgSqlTaggedStatement * end_statement )

Prepare statements.

Creates the prepared statements for all of the SQL statements used by the PostgreSQL backend.

Parameters
start_statementPointer to the first statement in range of the statements to be compiled.
end_statementPointer to the statement marking end of the range of statements to be compiled. This last statement is not compiled.
Exceptions
isc::db::DbOperationErrorAn operation on the open database has failed.

Definition at line 304 of file pgsql_connection.cc.

References prepareStatement().

+ Here is the call graph for this function:

◆ rollback()

void isc::db::PgSqlConnection::rollback ( )

Rollbacks current transaction.

Rolls back all pending database operations. On databases that don't support transactions, this is a no-op.

When this method is called for a nested transaction it decrements the transaction reference counter incremented during the call to startTransaction.

Exceptions
DbOperationErrorIf the rollback failed.

Definition at line 554 of file pgsql_connection.cc.

References isc::db::DatabaseConnection::checkUnusable(), conn_, isc::db::DB_DBG_TRACE_DETAIL, isc_throw, isc::db::PGSQL_ROLLBACK, and transaction_ref_count_.

Referenced by isc::db::PgSqlTransaction::~PgSqlTransaction().

+ Here is the call graph for this function:

◆ rollbackToSavepoint()

void isc::db::PgSqlConnection::rollbackToSavepoint ( const std::string & name)

Rollbacks to the given savepoint.

Rolls back all pending database operations made after the named savepoint.

Parameters
namename of the savepoint to which to rollback.
Exceptions
InvalidOperationif called outside a transaction.
DbOperationErrorif the rollback failed.

Definition at line 585 of file pgsql_connection.cc.

References executeSQL(), isc_throw, and transaction_ref_count_.

+ Here is the call graph for this function:

◆ selectQuery()

void isc::db::PgSqlConnection::selectQuery ( PgSqlTaggedStatement & statement,
const PsqlBindArray & in_bindings,
ConsumeResultRowFun process_result_row )

Executes SELECT query using prepared statement.

The statement parameter refers to an existing prepared statement associated with the connection. The in_bindings size must match the number of placeholders in the prepared statement.

This method executes prepared statement using provided input bindings and calls process_result_row function for each returned row. The process_result_row function is implemented by the caller and should gather and store each returned row in an external data structure prior.

Parameters
statementreference to the precompiled tagged statement to execute
in_bindingsinput bindings holding values to substitue placeholders in the query.
process_result_rowPointer to the function to be invoked for each retrieved row. This function consumes the retrieved data from the result set.

Definition at line 635 of file pgsql_connection.cc.

References executePreparedStatement(), isc_throw, and isc::Exception::what().

+ Here is the call graph for this function:

◆ startRecoverDbConnection()

void isc::db::PgSqlConnection::startRecoverDbConnection ( )
inline

The recover connection.

This function starts the recover process of the connection.

Note
The recover function must be run on the IO Service thread.

Definition at line 483 of file pgsql_connection.h.

References isc::db::DatabaseConnection::callback_, io_service_, io_service_accessor_, and isc::db::DatabaseConnection::reconnectCtl().

Referenced by checkStatementError().

+ Here is the call graph for this function:

◆ startTransaction()

void isc::db::PgSqlConnection::startTransaction ( )

Starts new transaction.

This function begins a new transaction by sending the START TRANSACTION statement to the database. The transaction should be explicitly committed by calling commit() or rolled back by calling rollback().

PostgreSQL does not support nested transactions directly. Issuing a START TRANSACTION while already in a transaction will cause a warning to be emitted but otherwise does not alter the state of the current transaction. In other words, the transaction will still end upon the next COMMIT or ROLLBACK statement.

Therefore, this function checks if a transaction has already started and does not start a new transaction. However, it increments a transaction reference counter which is later decremented when commit() or rollback() is called. When this mechanism is used properly, it guarantees that nested transactions are not attempted, thus avoiding unexpected commits or rollbacks of the pending transaction.

Definition at line 512 of file pgsql_connection.cc.

References isc::db::DatabaseConnection::checkUnusable(), conn_, isc::db::DB_DBG_TRACE_DETAIL, isc_throw, isc::db::PGSQL_START_TRANSACTION, and transaction_ref_count_.

Referenced by isc::db::PgSqlTransaction::PgSqlTransaction().

+ Here is the call graph for this function:

◆ toKeaAdminParameters()

tuple< vector< string >, vector< string > > isc::db::PgSqlConnection::toKeaAdminParameters ( ParameterMap const & params)
static

Convert PostgreSQL library parameters to kea-admin parameters.

Parameters
paramsinput PostgreSQL parameters
Returns
tuple of (vector of kea-admin parameters, vector of PostgreSQL environment variables)

Definition at line 258 of file pgsql_connection.cc.

Referenced by initializeSchema().

◆ updateDeleteQuery()

uint64_t isc::db::PgSqlConnection::updateDeleteQuery ( PgSqlTaggedStatement & statement,
const PsqlBindArray & in_bindings )

Executes UPDATE or DELETE prepared statement and returns the number of affected rows.

The statement must refer to an existing prepared statement associated with the connection. The in_bindings size must match the number of placeholders in the prepared statement.

Parameters
statementreference to the precompiled tagged statement to execute
in_bindingsInput bindings holding values to substitute placeholders in the query.
Returns
Number of affected rows.

Definition at line 663 of file pgsql_connection.cc.

References executePreparedStatement().

+ Here is the call graph for this function:

Member Data Documentation

◆ conn_

PgSqlHolder isc::db::PgSqlConnection::conn_

PgSql connection handle.

This field is public, because it is used heavily from PgSqlLeaseMgr and from PgSqlHostDataSource.

Definition at line 573 of file pgsql_connection.h.

Referenced by ~PgSqlConnection(), checkStatementError(), commit(), executePreparedStatement(), executeSQL(), operator bool(), operator PGconn *(), prepareStatement(), rollback(), and startTransaction().

◆ DUPLICATE_KEY

const char isc::db::PgSqlConnection::DUPLICATE_KEY = ERRCODE_UNIQUE_VIOLATION
static

Define the PgSql error state for a duplicate key error.

Definition at line 201 of file pgsql_connection.h.

Referenced by checkStatementError().

◆ io_service_

isc::asiolink::IOServicePtr isc::db::PgSqlConnection::io_service_

IOService object, used for all ASIO operations.

Definition at line 621 of file pgsql_connection.h.

Referenced by startRecoverDbConnection().

◆ io_service_accessor_

IOServiceAccessorPtr isc::db::PgSqlConnection::io_service_accessor_

Accessor function which returns the IOService that can be used to recover the connection.

This accessor is used to lazy retrieve the IOService when the connection is lost. It is useful to retrieve it at a later time to support hook libraries which create managers on load and set IOService later on by using the dhcp4_srv_configured and dhcp6_srv_configured hooks.

Definition at line 618 of file pgsql_connection.h.

Referenced by startRecoverDbConnection().

◆ KEA_ADMIN_

std::string isc::db::PgSqlConnection::KEA_ADMIN_ = KEA_ADMIN
static

Holds location to kea-admin.

By default, it points to kea-admin from installation. In tests, it points to kea-admin from sources.

Definition at line 633 of file pgsql_connection.h.

Referenced by initializeSchema().

◆ NULL_KEY

const char isc::db::PgSqlConnection::NULL_KEY = ERRCODE_NOT_NULL_VIOLATION
static

Define the PgSql error state for a null foreign key error.

Definition at line 203 of file pgsql_connection.h.

Referenced by checkStatementError().

◆ transaction_ref_count_

int isc::db::PgSqlConnection::transaction_ref_count_

Reference counter for transactions.

It precludes starting and committing nested transactions. PostgreSQL logs but ignores START TRANSACTIONs (or BEGINs) issued from within an ongoing transaction. We do not want to start new transactions when one is already in progress.

Definition at line 629 of file pgsql_connection.h.

Referenced by commit(), createSavepoint(), isTransactionStarted(), rollback(), rollbackToSavepoint(), and startTransaction().

◆ warned_about_tls

bool isc::db::PgSqlConnection::warned_about_tls = false
static

Emit the TLS support warning only once.

Definition at line 209 of file pgsql_connection.h.


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