lintel 0.2.0
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
lintel::db::Connection Class Reference

#include <Connection.h>

Public Member Functions

 Connection (ConnectionType connectionType, const std::string &connectionInfo)
 
 Connection (const std::shared_ptr< DatabaseConnectionEntry > &connectionEntry)
 
 Connection (Connection &connection)=delete
 
bool isHealthy () const
 

Friends

class Transaction
 
class Statement
 
class PreparedStatement
 
class Notify
 
class Cursor
 

Detailed Description

Unified database connection wrapping either a PostgreSQL or SQLite connection.

Constructor & Destructor Documentation

◆ Connection() [1/3]

lintel::db::Connection::Connection ( ConnectionType  connectionType,
const std::string &  connectionInfo 
)
explicit

Constructs a connection from a type and connection info string.

Parameters
connectionTypethe database type (PostgreSQL or SQLite)
connectionInfoconnection string or file path

◆ Connection() [2/3]

lintel::db::Connection::Connection ( const std::shared_ptr< DatabaseConnectionEntry > &  connectionEntry)
explicit

Constructs a connection from a database connection configuration entry.

Parameters
connectionEntrythe configuration entry describing the connection

◆ Connection() [3/3]

lintel::db::Connection::Connection ( Connection &  connection)
explicitdelete

Member Function Documentation

◆ isHealthy()

bool lintel::db::Connection::isHealthy ( ) const

Reports whether the underlying driver still considers the connection usable.

PostgreSQL asks PQstatus; SQLite runs a lightweight SELECT 1 probe (the recent error code is not a reliable health signal, because it stays set after a non-fatal error such as a constraint violation). Used by lintel::db::ConnectionPool to drop broken connections on release.

Returns
true when the connection may be reused

Friends And Related Symbol Documentation

◆ Cursor

◆ Notify

◆ PreparedStatement

◆ Statement

◆ Transaction


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