# Poco::Data::MySQL

# class StatementExecutor

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

## Description

MySQL statement executor.

## Member Summary

Member Functions: bindParams, bindResult, execute, fetch, fetchColumn, getAffectedRowCount, operator MYSQL_STMT *, prepare, state

## Enumerations

### State

STMT_INITED

STMT_COMPILED

STMT_EXECUTED

## Constructors

### StatementExecutor

explicit StatementExecutor(
MYSQL * mysql
);

Creates the StatementExecutor.

## Destructor

### ~StatementExecutor

~StatementExecutor();

Destroys the StatementExecutor.

## Member Functions

### bindParams

void bindParams(
MYSQL_BIND * params,
std::size_t count
);

Binds the params.

### bindResult

void bindResult(
MYSQL_BIND * result
);

Binds result.

### execute

void execute();

Executes the statement.

### fetch

bool fetch();

Fetches the data.

### fetchColumn

bool fetchColumn(
std::size_t n,
MYSQL_BIND * bind
);

Fetches the column.

### getAffectedRowCount

int getAffectedRowCount() const;

### operator MYSQL_STMT *

operator MYSQL_STMT * ();

Cast operator to native handle type.

### prepare

void prepare(
const std::string & query
);

Prepares the statement for execution.

### state

int state() const;

Returns the current state.