# Poco::Data::MySQL

# class SessionImpl

Library: Data/MySQL
Package: MySQL
Header: Poco/Data/MySQL/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, getInsertId, getTransactionIsolation, handle, hasTransactionIsolation, isAutoCommit, isConnected, isTransaction, isTransactionIsolation, open, rollback, setConnectionTimeout, setInsertId, setTransactionIsolation

## Constructors

### SessionImpl

SessionImpl(
const std::string & connectionString,
std::size_t loginTimeout = 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' | 'db' } 'compress' | 'auto-reconnect'
    <value> == [~;]*

for compress and auto-reconnect correct values are true/false for port - numeric in decimal notation

## Destructor

### ~SessionImpl

~SessionImpl();

Destroys the SessionImpl.

## Member Functions

### autoCommit

void autoCommit(
const std::string & param12,
bool val
);

Sets autocommit property for the session.

### begin

void begin();

Starts a transaction

### canTransact

bool canTransact();

Returns true if session has transaction capabilities.

### close

void close();

Closes the connection.

### commit

void commit();

Commits and ends a transaction

### connectorName

const std::string & connectorName() const;

Returns the name of the connector.

### createStatementImpl

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

Returns an MySQL StatementImpl

### getConnectionTimeout

std::size_t getConnectionTimeout();

Returns the session connection timeout value.

### getInsertId

Poco::Any getInsertId(
const std::string & param15
);

Get insert id

### getTransactionIsolation

Poco::UInt32 getTransactionIsolation();

Returns the transaction isolation level.

### handle

SessionHandle & handle();

### hasTransactionIsolation

bool hasTransactionIsolation(
Poco::UInt32 ti
);

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

### isAutoCommit

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

Returns autocommit property value.

### isConnected

bool isConnected();

Returns true if connected, false otherwise.

### isTransaction

bool isTransaction();

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

### isTransactionIsolation

bool isTransactionIsolation(
Poco::UInt32 ti
);

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

### open

void open(
const std::string & connection = ""
);

Opens a connection to the database.

### rollback

void rollback();

Aborts a transaction

### setConnectionTimeout

void setConnectionTimeout(
std::size_t timeout
);

Sets the session connection timeout value.

### setInsertId

void setInsertId(
const std::string & param13,
const Poco::Any & param14
);

Try to set insert id - do nothing.

### setTransactionIsolation

void setTransactionIsolation(
Poco::UInt32 ti
);

Sets the transaction isolation level.

## Variables

### MYSQL_READ_COMMITTED

static const std::string MYSQL_READ_COMMITTED;

### MYSQL_READ_UNCOMMITTED

static const std::string MYSQL_READ_UNCOMMITTED;

### MYSQL_REPEATABLE_READ

static const std::string MYSQL_REPEATABLE_READ;

### MYSQL_SERIALIZABLE

static const std::string MYSQL_SERIALIZABLE;