Poco::Data::PostgreSQL

class SessionHandle

File Information

Library: Data/PostgreSQL
Package: PostgreSQL
Header: Poco/Data/PostgreSQL/SessionHandle.h

Description

PostgreSQL connection(session) handle

Member Summary

Member Functions: cancel, clientEncoding, commit, connect, connectionDefaultParameters, connectionParameters, connectionString, deallocatePreparedStatement, disconnect, hasTransactionIsolation, isAsynchronousCommit, isAutoCommit, isConnected, isTransaction, lastError, libpqVersion, mutex, operator PGconn *, protocoVersion, reset, rollback, serverProcessID, serverVersion, setAsynchronousCommit, setAutoCommit, setTransactionIsolation, startTransaction, transactionIsolation

Constructors

SessionHandle

explicit SessionHandle();

Creates session handle

Destructor

~SessionHandle

~SessionHandle();

Destroy handle, close connection

Member Functions

cancel

void cancel();

Attempts to cancel in-process statements

clientEncoding

std::string clientEncoding() const;

returns the client encoding

commit

void commit();

Commit transaction

connect

void connect(
    const std::string & aConnectionString
);

Connect to server

connect

void connect(
    const char * aConnectionString
);

connect

void connect(
    const char * aHost,
    const char * aUser,
    const char * aPassword,
    const char * aDatabase,
    unsigned short aPort,
    unsigned int aConnectionTimeout
);

connectionDefaultParameters static

static SessionParametersMap connectionDefaultParameters();

returns the default parameters used on a connection

connectionParameters

SessionParametersMap connectionParameters() const;

returns the parameters used on the connection

connectionString inline

std::string connectionString() const;

returns the string used to connect

deallocatePreparedStatement

void deallocatePreparedStatement(
    const std::string & aPreparedStatementToDeAllocate
);

deallocates a previously prepared statement

disconnect

void disconnect();

Close connection

hasTransactionIsolation

bool hasTransactionIsolation(
    Poco::UInt32 aTI
);

Returns true iff the transaction isolation level corresponding to the supplied bitmask is supported.

isAsynchronousCommit inline

bool isAsynchronousCommit();

is the connection in Asynchronous commit mode?

isAutoCommit inline

bool isAutoCommit();

is the connection in auto commit mode?

isConnected

bool isConnected() const;

is a connection established?

isTransaction inline

bool isTransaction();

Returns true iff a transaction is a transaction is in progress, false otherwise.

lastError

std::string lastError() const;

last error on the connection

libpqVersion

int libpqVersion() const;

returns the version of libpq

mutex inline

Poco::FastMutex & mutex();

Get the sessionHandle mutex to protect the connection pointer

operator PGconn * inline

operator PGconn * ();

Get the PostgreSQL connection pointer

protocoVersion

int protocoVersion() const;

the protocol version between the client and the server

reset

bool reset();

reset the connection

rollback

void rollback();

Rollback trabsaction

serverProcessID

int serverProcessID() const;

the process ID of the remotee server process

serverVersion

int serverVersion() const;

remote server version

setAsynchronousCommit

void setAsynchronousCommit(
    bool aShouldAsynchronousCommit = true
);

is the connection in Asynchronous commit mode?

setAutoCommit

void setAutoCommit(
    bool aShouldAutoCommit = true
);

is the connection in auto commit mode?

setTransactionIsolation

void setTransactionIsolation(
    Poco::UInt32 aTI
);

Sets the transaction isolation level.

startTransaction

void startTransaction();

Start transaction

transactionIsolation

Poco::UInt32 transactionIsolation();

Returns the transaction isolation level.

Securely control IoT edge devices from anywhere   Connect a Device