# Poco::Data::PostgreSQL

# class SessionImpl

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

## Description

Implements SessionImpl interface

## Inheritance

Direct Base Classes: Poco::Data::AbstractSessionImpl < SessionImpl >

All Base Classes: Poco::Data::AbstractSessionImpl < SessionImpl >

## Member Summary

Member Functions: autoCommit, begin, canTransact, close, commit, connectorName, createStatementImpl, getConnectionTimeout, getTransactionIsolation, handle, hasTransactionIsolation, isAsynchronousCommit, isAutoCommit, isBinaryExtraction, isConnected, isTransaction, isTransactionIsolation, open, reset, rollback, setAsynchronousCommit, setBinaryExtraction, setConnectionTimeout, setName, setTransactionIsolation

## Constructors

### SessionImpl

SessionImpl(
const std::string & aConnectionString,
std::size_t aLoginTimeout = LOGIN_TIMEOUT_DEFAULT
);

Creates the SessionImpl. Opens a connection to the database

Connection string format: <str> == <assignment> | <assignment> ' ' <str> <assignment> == <name> '=' <value> <name> == 'host' | 'port' | 'user' | 'password' | 'dbname' | 'connect_timeout' <value> == [~;]*

consult postgres documentation for other parameters

## Destructor

### ~SessionImpl

~SessionImpl();

Destroys the SessionImpl.

## Member Functions

### autoCommit

void autoCommit(
const std::string & param58,
bool aValue
);

Sets autocommit property for the session.

### begin

void begin();

Starts a transaction

### canTransact

bool canTransact() const;

Returns true if session has transaction capabilities.

### close

void close();

Closes the connection.

### commit

void commit();

Commits and ends a transaction

### connectorName

const std::string & connectorName() const;

Returns the name of the connector.

### createStatementImpl

Poco::Data::StatementImpl::Ptr createStatementImpl();

Returns an PostgreSQL StatementImpl

### getConnectionTimeout

std::size_t getConnectionTimeout() const;

Returns the session connection timeout value.

### getTransactionIsolation

Poco::UInt32 getTransactionIsolation() const;

Returns the transaction isolation level.

### handle

SessionHandle & handle();

Get handle

### hasTransactionIsolation

bool hasTransactionIsolation(
Poco::UInt32 aTI
) const;

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

### isAsynchronousCommit

bool isAsynchronousCommit(
const std::string & aName = std::string ()
) const;

is the connection in Asynchronous commit mode?

### isAutoCommit

bool isAutoCommit(
const std::string & aName = std::string ()
) const;

Returns autocommit property value.

### isBinaryExtraction

bool isBinaryExtraction(
const std::string & feature = std::string ()
) const;

Returns true if binary extraction is enabled, otherwise false. See setBinaryExtraction() for more information.

### isConnected

bool isConnected() const;

Returns true if connected, false otherwise.

### isTransaction

bool isTransaction() const;

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

### isTransactionIsolation

bool isTransactionIsolation(
Poco::UInt32 aTI
) const;

Returns true iff the transaction isolation level corresponds to the supplied bitmask.

### open

void open(
const std::string & aConnectionString = std::string ()
);

Opens a connection to the database.

### reset

void reset();

Do nothing

### rollback

void rollback();

Aborts a transaction

### setAsynchronousCommit

void setAsynchronousCommit(
const std::string & param59,
bool aValue
);

Sets asynchronousCommit property for the session.

### setBinaryExtraction

void setBinaryExtraction(
const std::string & feature,
bool enabled
);

Sets the "binaryExtraction" feature. If set, column values received from PostgreSQL client will be extracted as binary values. This improves extraction performance, but will not work with all types.

If not set, all column values will be extracted as strings. This gives lower performance, but allows to extract also types not supported directly by Poco::Data.

### setConnectionTimeout

void setConnectionTimeout(
std::size_t aTimeout
);

Sets the session connection timeout value.

### setName

void setName();

### setTransactionIsolation

void setTransactionIsolation(
Poco::UInt32 aTI
);

Sets the transaction isolation level.