# Poco::Data::SQLite

# class SessionImpl

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

## Description

Implements SessionImpl interface.

The following properties are supported:

- transactionMode: "DEFERRED", "IMMEDIATE" or "EXCLUSIVE"
- maxRetryAttempts: maximum number of attemptes to retry an operation if database is locked or busy. Between retry attempts, sleep for a random time.
- minRetrySleep: the minimum time (in milliseconds) waited between two retry attempts.
- maxRetrySleep: the maximum time (in milliseconds) waited between two retry attempts.

Notes: For automatic retries to work, you should start every transaction that at one point will write to the database with IMMEDIATE or EXCLUSIVE mode.

## Inheritance

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

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

## Member Summary

Member Functions: begin, close, commit, createStatementImpl, getMaxRetryAttempts, getMaxRetrySleep, getMinRetrySleep, getTransactionMode, isConnected, isTransaction, rollback, setMaxRetryAttempts, setMaxRetrySleep, setMinRetrySleep, setTransactionMode

## Enumerations

### Anonymous

DEFAULT_MAX_RETRY_ATTEMPTS = 0

Default maximum number of attempts to retry an operation if the database is locked.

DEFAULT_MIN_RETRY_SLEEP = 2

Default minimum sleep interval (milliseconds) between retry attempts.

DEFAULT_MAX_RETRY_SLEEP = 20

Default maximum sleep interval (milliseconds) between retry attempts.

## Constructors

### SessionImpl

SessionImpl(
const std::string & fileName
);

Creates the SessionImpl. Opens a connection to the database.

## Destructor

### ~SessionImpl

~SessionImpl();

Destroys the SessionImpl.

## Member Functions

### begin

void begin();

Starts a transaction.

### close

void close();

Closes the session.

### commit

void commit();

Commits and ends a transaction.

### createStatementImpl

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

Returns an SQLite StatementImpl.

### isConnected

bool isConnected();

Returns true if and only if connected, false otherwise.

### isTransaction

bool isTransaction();

Returns true if and only if a transaction is in progress.

### rollback

void rollback();

Aborts a transaction.

### getMaxRetryAttempts

Poco::Any getMaxRetryAttempts(
const std::string & prop
);

### getMaxRetrySleep

Poco::Any getMaxRetrySleep(
const std::string & prop
);

### getMinRetrySleep

Poco::Any getMinRetrySleep(
const std::string & prop
);

### getTransactionMode

Poco::Any getTransactionMode(
const std::string & prop
);

### setMaxRetryAttempts

void setMaxRetryAttempts(
const std::string & prop,
const Poco::Any & value
);

### setMaxRetrySleep

void setMaxRetrySleep(
const std::string & prop,
const Poco::Any & value
);

### setMinRetrySleep

void setMinRetrySleep(
const std::string & prop,
const Poco::Any & value
);

### setTransactionMode

void setTransactionMode(
const std::string & prop,
const Poco::Any & value
);