Class Poco::Data::SessionImpl
Author: Applied Informatics Software Engineering GmbH and Contributors

# Poco::Data

# class SessionImpl

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

## Description

Interface for Session functionality that subclasses must extend. SessionImpl objects are noncopyable.

## Inheritance

Direct Base Classes: Poco::RefCountedObject

All Base Classes: Poco::RefCountedObject

Known Derived Classes: AbstractSessionImpl, PooledSessionImpl

## Member Summary

Member Functions: begin, canTransact, close, commit, connectionString, connectorName, createStatementImpl, getConnectionTimeout, getFeature, getLoginTimeout, getProperty, getTransactionIsolation, hasTransactionIsolation, isConnected, isTransaction, isTransactionIsolation, open, reconnect, rollback, setConnectionString, setConnectionTimeout, setFeature, setLoginTimeout, setProperty, setTransactionIsolation, uri

Inherited Functions: duplicate, referenceCount, release

## Constructors

### SessionImpl

SessionImpl(
const std::string & connectionString,
std::size_t timeout = LOGIN_TIMEOUT_DEFAULT
);

Creates the SessionImpl.

## Destructor

### ~SessionImpl

virtual ~SessionImpl();

Destroys the SessionImpl.

## Member Functions

### begin

virtual void begin() = 0;

Starts a transaction.

### canTransact

virtual bool canTransact() = 0;

Returns true if session has transaction capabilities.

### close

virtual void close() = 0;

Closes the connection.

### commit

virtual void commit() = 0;

Commits and ends a transaction.

### connectionString

const std::string & connectionString() const;

Returns the connection string.

### connectorName

virtual const std::string & connectorName() const = 0;

Returns the name of the connector.

### createStatementImpl

virtual StatementImpl * createStatementImpl() = 0;

Creates a StatementImpl.

### getConnectionTimeout

virtual std::size_t getConnectionTimeout() = 0;

Returns the session connection timeout value.

### getFeature

virtual bool getFeature(
const std::string & name
) = 0;

Look up the state of a feature.

Features are a generic extension mechanism for session implementations. and are defined by the underlying SessionImpl instance.

Throws a NotSupportedException if the requested feature is not supported by the underlying implementation.

### getLoginTimeout

std::size_t getLoginTimeout() const;

Returns the session login timeout value.

### getProperty

virtual Poco::Any getProperty(
const std::string & name
) = 0;

Look up the value of a property.

Properties are a generic extension mechanism for session implementations. and are defined by the underlying SessionImpl instance.

Throws a NotSupportedException if the requested property is not supported by the underlying implementation.

### getTransactionIsolation

virtual Poco::UInt32 getTransactionIsolation() = 0;

Returns the transaction isolation level.

### hasTransactionIsolation

virtual bool hasTransactionIsolation(
Poco::UInt32
) = 0;

Returns true if and only if the transaction isolation level corresponding to the supplied bitmask is supported.

### isConnected

virtual bool isConnected() = 0;

Returns true if session is connected, false otherwise.

### isTransaction

virtual bool isTransaction() = 0;

Returns true if and only if a transaction is a transaction is in progress, false otherwise.

### isTransactionIsolation

virtual bool isTransactionIsolation(
Poco::UInt32
) = 0;

Returns true if and only if the transaction isolation level corresponds to the supplied bitmask.

### open

virtual void open(
const std::string & connectionString = ""
) = 0;

Opens the session using the supplied string. Can also be used with default empty string to reconnect a disconnected session. If the connection is not established within requested timeout (specified in seconds), a ConnectionFailedException is thrown. Zero timout means indefinite

### reconnect

void reconnect();

Closes the connection and opens it again.

### rollback

virtual void rollback() = 0;

Aborts a transaction.

### setConnectionTimeout

virtual void setConnectionTimeout(
std::size_t timeout
) = 0;

Sets the session connection timeout value.

### setFeature

virtual void setFeature(
const std::string & name,
bool state
) = 0;

Set the state of a feature.

Features are a generic extension mechanism for session implementations. and are defined by the underlying SessionImpl instance.

Throws a NotSupportedException if the requested feature is not supported by the underlying implementation.

### setLoginTimeout

void setLoginTimeout(
std::size_t timeout
);

Sets the session login timeout value.

### setProperty

virtual void setProperty(
const std::string & name,
const Poco::Any & value
) = 0;

Set the value of a property.

Properties are a generic extension mechanism for session implementations. and are defined by the underlying SessionImpl instance.

Throws a NotSupportedException if the requested property is not supported by the underlying implementation.

### setTransactionIsolation

virtual void setTransactionIsolation(
Poco::UInt32
) = 0;

Sets the transaction isolation level.

### uri

static std::string uri(
const std::string & connector,
const std::string & connectionString
);

Returns formatted URI.

### uri

std::string uri() const;

Returns the URI for this session.

### setConnectionString

void setConnectionString(
const std::string & connectionString
);

Sets the connection string. Should only be called on disconnetced sessions. Throws InvalidAccessException when called on a connected session.

## Variables

### CONNECTION_TIMEOUT_DEFAULT

static const std::size_t CONNECTION_TIMEOUT_DEFAULT = CONNECTION_TIMEOUT_INFINITE;

Default connection/login timeout in seconds.

### CONNECTION_TIMEOUT_INFINITE

static const std::size_t CONNECTION_TIMEOUT_INFINITE = 0;

Infinite connection/login timeout.

### LOGIN_TIMEOUT_DEFAULT

static const std::size_t LOGIN_TIMEOUT_DEFAULT = 60;

Default connection/login timeout in seconds.

### LOGIN_TIMEOUT_INFINITE

static const std::size_t LOGIN_TIMEOUT_INFINITE = 0;

Infinite connection/login timeout.