# Poco::Data::MySQL

# class SessionHandle

Library: Data/MySQL
Package: MySQL
Header: Poco/Data/MySQL/SessionHandle.h

## Description

MySQL session handle

## Member Summary

Member Functions: close, commit, connect, init, operator MYSQL *, options, ping, reset, rollback, startTransaction

## Constructors

### SessionHandle

explicit SessionHandle(
MYSQL * mysql
);

Creates session handle

## Destructor

### ~SessionHandle

~SessionHandle();

Destroy handle, close connection

## Member Functions

### close

void close();

Close connection

### commit

void commit();

Commit transaction

### connect

void connect(
const char * host,
const char * user,
const char * password,
const char * db,
unsigned int port
);

Connect to server

### init

void init(
MYSQL * mysql = 0
);

Initializes the handle iff not initialized.

### operator MYSQL *

operator MYSQL * ();

### options

void options(
mysql_option opt
);

Set connection options

### options

void options(
mysql_option opt,
bool b
);

Set connection options

### options

void options(
mysql_option opt,
const char * c
);

Set connection options

### options

void options(
mysql_option opt,
unsigned int i
);

Set connection options

### ping

bool ping();

Checks if the connection is alive.

### reset

void reset();

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

### rollback

void rollback();

Rollback transaction

### startTransaction

void startTransaction();

Start transaction