# 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() override;

Destroys the SessionImpl.

## Member Functions

### autoCommit

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

Sets autocommit property for the session.

### begin

void begin() override;

Starts a transaction

### canTransact

bool canTransact() const override;

Returns true if session has transaction capabilities.

### close

void close() override;

Closes the connection.

### commit

void commit() override;

Commits and ends a transaction

### connectorName

const std::string & connectorName() const override;

Returns the name of the connector.

### createStatementImpl

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

Returns an PostgreSQL StatementImpl

### getConnectionTimeout

std::size_t getConnectionTimeout() const override;

Returns the session connection timeout value.

### getTransactionIsolation

Poco::UInt32 getTransactionIsolation() const override;

Returns the transaction isolation level.

### handle

SessionHandle & handle();

Get handle

### hasTransactionIsolation

bool hasTransactionIsolation(
Poco::UInt32 aTI
) const override;

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 override;

Returns true if connected, false otherwise.

### isTransaction

bool isTransaction() const override;

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

### isTransactionIsolation

bool isTransactionIsolation(
Poco::UInt32 aTI
) const override;

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

### open

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

Opens a connection to the database.

### reset

void reset() override;

Do nothing

### rollback

void rollback() override;

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
) override;

Sets the session connection timeout value.

### setName

void setName();

### setTransactionIsolation

void setTransactionIsolation(
Poco::UInt32 aTI
) override;

Sets the transaction isolation level.