Library: Data
Package: DataCore
Header: Poco/Data/Statement.h
A Statement is used to execute SQL statements. It does not contain code of its own. Its main purpose is to forward calls to the concrete StatementImpl stored inside.
Known Derived Classes: RecordSet
Member Functions: done, execute, extractions, metaColumn, operator <<, operator =, operator,, swap, toString
typedef void (* Manipulator)(Statement &);
Statement(
StatementImpl * pImpl
);
Creates the Statement.
explicit Statement(
Session & session
);
Creates the Statement for the given Session.
The following:
Statement stmt(sess); stmt << "SELECT * FROM Table", ...
is equivalent to:
Statement stmt(sess << "SELECT * FROM Table", ...);
but in some cases better readable.
Statement(
const Statement & stmt
);
Copy constructor
~Statement();
Destroys the Statement.
bool done();
Returns if the statement was completely executed or if a previously set limit stopped it and there is more work to do. When no limit is set, it will always - after calling execute() - return true.
Poco::UInt32 execute();
Executes the whole statement. Stops when either a limit is hit or the whole statement was executed. Returns the number of rows extracted from the Database.
template < typename T > Statement & operator << (
const T & t
);
Concatenates the send data to a string version of the SQL statement.
Statement & operator = (
const Statement & stmt
);
Assignment operator.
Statement & operator, (
Manipulator manip
);
Handles manipulators, such as now.
Statement & operator, (
AbstractBinding * info
);
Statement & operator, (
AbstractExtraction * extract
);
Registers objects used for extracting data at the Statement.
Statement & operator, (
const Limit & extrLimit
);
Sets a limit on the maximum number of rows a select is allowed to return.
Set per default to Limit::LIMIT_UNLIMITED which disables the limit.
Statement & operator, (
const Range & extrRange
);
Sets a an etxraction Range on the maximum number of rows a select is allowed to return.
Set per default to Limit::LIMIT_UNLIMITED which disables the range.
void swap(
Statement & other
);
Swaps the statement with another one.
std::string toString() const;
Creates a string from the accumulated SQL statement
const AbstractExtractionVec & extractions() const;
Returns the extractions vector.
const MetaColumn & metaColumn(
std::size_t pos
) const;
Returns the type for the column at specified position.
const MetaColumn & metaColumn(
const std::string & name
) const;
Returns the type for the column with specified name.