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

virtual ~StatementImpl();

Destroys the StatementImpl.

Member Functions

add inline

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

Appends SQl statement (fragments).

addBinding inline

void addBinding(
    AbstractBinding * info
);

Registers the Binding at the StatementImpl.

addExtract inline

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 inline

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 inline

std::string toString() const;

Create a string version of the SQL statement.

bindImpl protected virtual

virtual void bindImpl() = 0;

Binds parameters.

binder protected virtual

virtual AbstractBinder & binder() = 0;

Returns the concrete binder used by the statement.

bindings protected inline

const AbstractBindingVec & bindings() const;

Returns the bindings.

bindings protected

AbstractBindingVec & bindings();

Returns the bindings.

canBind protected virtual

virtual bool canBind() const = 0;

Returns if another bind is possible.

columnsExtracted protected inline

int columnsExtracted() const;

Returns the number of columns that the extractors handle.

columnsReturned protected virtual

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

Returns number of columns returned by query.

compileImpl protected virtual

virtual void compileImpl() = 0;

Compiles the statement, doesn't bind yet.

extractions protected inline

const AbstractExtractionVec & extractions() const;

Returns the extractions vector.

extractions protected

AbstractExtractionVec & extractions();

Returns the extractions vector.

extractor protected virtual

virtual AbstractExtractor & extractor() = 0;

Returns the concrete extractor used by the statement.

hasNext protected virtual

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 protected

void makeExtractors(
    Poco::UInt32 count
);

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

metaColumn protected virtual

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

Returns column meta data.

metaColumn protected

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

Returns column meta data.

next protected virtual

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