# Poco::Data

# template < class C >

# class AbstractSessionImpl

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

## Description

A partial implementation of SessionImpl, providing features and properties management.

To implement a certain feature or property, a subclass must provide setter and getter methods and register them with addFeature() or addProperty().

## Inheritance

Direct Base Classes: SessionImpl

All Base Classes: SessionImpl, Poco::RefCountedObject

## Member Summary

Member Functions: addFeature, addProperty, getBulk, getEmptyStringIsNull, getFeature, getForceEmptyString, getHandle, getProperty, getStorage, setBulk, setEmptyStringIsNull, setFeature, setForceEmptyString, setHandle, setProperty, setStorage

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

## Types

### Poco::Any

typedef Poco::Any (C::* PropertyGetter)(const std::string &)const;

The getter method for a property.

### bool

typedef bool (C::* FeatureGetter)(const std::string &)const;

The getter method for a feature.

### void

typedef void (C::* FeatureSetter)(const std::string &, bool);

The setter method for a feature.

### void

typedef void (C::* PropertySetter)(const std::string &, const Poco::Any &);

The setter method for a property.

## Constructors

### AbstractSessionImpl

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

Creates the AbstractSessionImpl.

Adds "storage" property and sets the default internal storage container type to std::deque. The storage is created by statements automatically whenever a query returning results is executed but external storage is provided by the user. Storage type can be reconfigured at runtime both globally (for the duration of the session) and locally (for a single statement execution only). See StatementImpl for details on how this property is used at runtime.

Adds "handle" property which, if set by the back end, returns native handle for the back end DB.

Adds "bulk" feature and sets it to false. Bulk feature determines whether the session is capable of bulk operations. Connectors that are capable of it must set this feature prior to attempting bulk operations.

Adds "emptyStringIsNull" feature and sets it to false. This feature should be set to true in order to modify the behavior of the databases that distinguish between zero-length character strings as nulls. Setting this feature to true shall disregard any difference between empty character strings and nulls, causing the framework to treat them the same (i.e. behave like Oracle).

Adds "forceEmptyString" feature and sets it to false. This feature should be set to true in order to force the databases that do not distinguish empty strings from nulls (e.g. Oracle) to always report empty string.

The "emptyStringIsNull" and "forceEmptyString" features are mutually exclusive. While these features can not both be true at the same time, they can both be false, resulting in default underlying database behavior.

## Destructor

### ~AbstractSessionImpl

~AbstractSessionImpl();

Destroys the AbstractSessionImpl.

## Member Functions

### getBulk

bool getBulk(
const std::string & name = ""
) const;

Returns the execution type

### getEmptyStringIsNull

bool getEmptyStringIsNull(
const std::string & name = ""
) const;

Returns the setting for the behavior regarding empty variable length strings. See setEmptyStringIsNull(const std::string&, bool) and this class documentation for feature rationale and details.

### getFeature

bool getFeature(
const std::string & name
);

Looks a feature up in the features map and calls the feature's getter, if there is one.

See also: Poco::Data::SessionImpl::getFeature()

### getForceEmptyString

bool getForceEmptyString(
const std::string & name = ""
) const;

Returns the setting for the behavior regarding empty variable length strings. See setForceEmptyString(const std::string&, bool) and this class documentation for feature rationale and details.

### getHandle

Poco::Any getHandle(
const std::string & name = ""
) const;

Returns the native session handle.

### getProperty

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

Looks a property up in the properties map and calls the property's getter, if there is one.

See also: Poco::Data::SessionImpl::getProperty()

### getStorage

Poco::Any getStorage(
const std::string & name = ""
) const;

Returns the storage type

### setBulk

void setBulk(
const std::string & name,
bool bulk
);

Sets the execution type.

### setEmptyStringIsNull

void setEmptyStringIsNull(
const std::string & name,
bool emptyStringIsNull
);

Sets the behavior regarding empty variable length strings. Those are treated as NULL by Oracle and as empty string by most other databases. When this feature is true, empty strings are treated as NULL.

### setFeature

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

Looks a feature up in the features map and calls the feature's setter, if there is one.

See also: Poco::Data::SessionImpl::setFeature()

### setForceEmptyString

void setForceEmptyString(
const std::string & name,
bool forceEmptyString
);

Sets the behavior regarding empty variable length strings. Those are treated as NULL by Oracle and as empty string by most other databases. When this feature is true, both empty strings and NULL values are reported as empty strings.

### setHandle

void setHandle(
const std::string & name,
const Poco::Any & handle
);

Sets the native session handle.

### setProperty

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

Looks a property up in the properties map and calls the property's setter, if there is one.

See also: Poco::Data::SessionImpl::setProperty()

### setStorage

void setStorage(
const std::string & value
);

Sets the storage type.

### setStorage

void setStorage(
const std::string & name,
const Poco::Any & value
);

Sets the storage type.

### addFeature

void addFeature(
const std::string & name,
FeatureSetter setter,
FeatureGetter getter
);

Adds a feature to the map of supported features.

The setter or getter can be null, in case setting or getting a feature is not supported.

### addProperty

void addProperty(
const std::string & name,
PropertySetter setter,
PropertyGetter getter
);

Adds a property to the map of supported properties.

The setter or getter can be null, in case setting or getting a property is not supported.