# Poco::Data

# class StatementImpl

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

## Description

StatementImpl interface that subclasses must implement to define database dependent query execution.

StatementImpl's are noncopyable.

## Inheritance

Direct Base Classes: Poco::RefCountedObject

All Base Classes: Poco::RefCountedObject

Known Derived Classes: Poco::Data::MySQL::MySQLStatementImpl, Poco::Data::ODBC::ODBCStatementImpl, Poco::Data::SQLite::SQLiteStatementImpl

## Member Summary

Member Functions: add, addBinding, addExtract, bindImpl, binder, bindings, canBind, columnsExtracted, columnsReturned, compileImpl, execute, extractions, extractor, getState, hasNext, makeExtractors, metaColumn, next, reset, setExtractionLimit, toString

Inherited Functions: duplicate, referenceCount, release

## Enumerations

### State

ST_INITIALIZED

ST_COMPILED

ST_BOUND

ST_DONE

ST_RESET

## Constructors

### StatementImpl

StatementImpl();

Creates the StatementImpl.

## Destructor

### ~StatementImpl

virtual ~StatementImpl();

Destroys the StatementImpl.

## Member Functions

### add

template < typename T > void add(
const T & t
);

Appends SQl statement (fragments).

### addBinding

void addBinding(
AbstractBinding * info
);

Registers the Binding at the StatementImpl.

### addExtract

void addExtract(
AbstractExtraction * info
);

Registers objects used for extracting data at the StatementImpl.

### execute

Poco::UInt32 execute();

Executes a statement. Returns the number of rows extracted.

### getState

State getState() const;

Returns the state of the Statement.

### reset

void reset();

Resets the statement, so that we can reuse all bindings and re-execute again.

### setExtractionLimit

void setExtractionLimit(
const Limit & extrLimit
);

Changes the extractionLimit to extrLimit. Per default no limit (EXTRACT_UNLIMITED) is set.

### toString

std::string toString() const;

Create a string version of the SQL statement.

### bindImpl

virtual void bindImpl() = 0;

Binds parameters.

### binder

virtual AbstractBinder & binder() = 0;

Returns the concrete binder used by the statement.

### bindings

const AbstractBindingVec & bindings() const;

Returns the bindings.

### bindings

AbstractBindingVec & bindings();

Returns the bindings.

### canBind

virtual bool canBind() const = 0;

Returns if another bind is possible.

### columnsExtracted

int columnsExtracted() const;

Returns the number of columns that the extractors handle.

### columnsReturned

virtual Poco::UInt32 columnsReturned() const = 0;

Returns number of columns returned by query.

### compileImpl

virtual void compileImpl() = 0;

Compiles the statement, doesn't bind yet.

### extractions

const AbstractExtractionVec & extractions() const;

Returns the extractions vector.

### extractions

AbstractExtractionVec & extractions();

Returns the extractions vector.

### extractor

virtual AbstractExtractor & extractor() = 0;

Returns the concrete extractor used by the statement.

### hasNext

virtual bool hasNext() = 0;

Returns true if a call to next() will return data.

Note that the implementation must support several consecutive calls to hasNext without data getting lost, ie. hasNext(); hasNext(); next() must be equal to hasNext(); next();

### makeExtractors

void makeExtractors(
Poco::UInt32 count
);

Creates extraction vector. Used in case when there is data returned, but no extraction supplied externally.

### metaColumn

virtual const MetaColumn & metaColumn(
Poco::UInt32 pos
) const = 0;

Returns column meta data.

### metaColumn

const MetaColumn & metaColumn(
const std::string & name
) const;

Returns column meta data.

### next

virtual void next() = 0;

Retrieves the next row from the resultset.

Will throw, if the resultset is empty. Expects the statement to be compiled and bound