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, dbmsName, getConnectionTimeout, getFeature, getLoginTimeout, getProperty, getTransactionIsolation, hasFeature, hasProperty, hasTransactionIsolation, isAutocommit, isConnected, isGood, isTransaction, isTransactionIsolation, open, reconnect, reset, rollback, setConnectionString, setConnectionTimeout, setDBMSName, setFeature, setLoginTimeout, setProperty, setTransactionIsolation, shouldParse, uri

Inherited Functions: duplicate, referenceCount, release

Types Aliases

Ptr

using Ptr = Poco::AutoPtr < SessionImpl >;

Constructors

SessionImpl

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

Creates the SessionImpl.

Destructor

~SessionImpl virtual

virtual ~SessionImpl();

Destroys the SessionImpl.

Member Functions

begin virtual

virtual void begin() = 0;

Starts a transaction.

canTransact virtual

virtual bool canTransact() const = 0;

Returns true if session has transaction capabilities.

close virtual

virtual void close() = 0;

Closes the connection.

commit virtual

virtual void commit() = 0;

Commits and ends a transaction.

connectionString inline

const std::string & connectionString() const;

Returns the connection string.

connectorName virtual

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

Returns the name of the connector.

createStatementImpl virtual

virtual Poco::SharedPtr < StatementImpl > createStatementImpl() = 0;

Creates a StatementImpl.

dbmsName inline

const std::string & dbmsName() const;

Returns the DBMS name. The name must be set by the implementation. Defaults to "unknown".

getConnectionTimeout virtual

virtual std::size_t getConnectionTimeout() const = 0;

Returns the session connection timeout value.

getFeature virtual

virtual bool getFeature(
    const std::string & name
) const = 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 inline

std::size_t getLoginTimeout() const;

Returns the session login timeout value.

getProperty virtual

virtual Poco::Any getProperty(
    const std::string & name
) const = 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

virtual Poco::UInt32 getTransactionIsolation() const = 0;

Returns the transaction isolation level.

hasFeature virtual

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

Returns true if session has the named feature.

hasProperty virtual

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

Returns true if session has the named feature.

hasTransactionIsolation virtual

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

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

isAutocommit inline

bool isAutocommit() const;

Returns true if autocommit is on, false otherwise.

isConnected virtual

virtual bool isConnected() const = 0;

Returns true if session is connected, false otherwise.

isGood virtual

virtual bool isGood() const;

Returns true if session is good and can be used, false otherwise.

The default implementation returns result of isConnected().

isTransaction virtual

virtual bool isTransaction() const = 0;

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

isTransactionIsolation virtual

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

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

open virtual

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.

reset virtual

virtual void reset() = 0;

Reset connection with dababase and clears session state, but without disconnecting

rollback virtual

virtual void rollback() = 0;

Aborts a transaction.

setConnectionTimeout virtual

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

Sets the session connection timeout value.

setFeature virtual

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 inline

void setLoginTimeout(
    std::size_t timeout
);

Sets the session login timeout value.

setProperty virtual

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

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

Sets the transaction isolation level.

shouldParse inline

bool shouldParse() const;

Returns true if SQL parser is enabled, false otherwise.

uri static inline

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 protected

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

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

setDBMSName protected inline

void setDBMSName(
    const std::string & name
);

Sets the DBMS name.

Variables

CONNECTION_TIMEOUT_DEFAULT static

static const std::size_t CONNECTION_TIMEOUT_DEFAULT = CONNECTION_TIMEOUT_INFINITE;

Default connection/login timeout in seconds.

CONNECTION_TIMEOUT_INFINITE static

static const std::size_t CONNECTION_TIMEOUT_INFINITE = 0;

Infinite connection/login timeout.

CURSOR_USE_ALWAYS static

static const int CURSOR_USE_ALWAYS = 0;

CURSOR_USE_IF_NEEDED static

static const int CURSOR_USE_IF_NEEDED = 1;

CURSOR_USE_NEVER static

static const int CURSOR_USE_NEVER = 2;

LOGIN_TIMEOUT_DEFAULT static

static const std::size_t LOGIN_TIMEOUT_DEFAULT = 60;

Default connection/login timeout in seconds.

LOGIN_TIMEOUT_INFINITE static

static const std::size_t LOGIN_TIMEOUT_INFINITE = 0;

Infinite connection/login timeout.