This class represents a statement that can be either executed or queried for result. More...
#include <cppdb/backend.h>
Public Member Functions | |
virtual void | reset ()=0 |
virtual std::string const & | sql_query ()=0 |
virtual void | bind (int col, std::string const &)=0 |
virtual void | bind (int col, char const *s)=0 |
virtual void | bind (int col, char const *b, char const *e)=0 |
virtual void | bind (int col, std::tm const &)=0 |
virtual void | bind (int col, std::istream &)=0 |
virtual void | bind (int col, int v)=0 |
virtual void | bind (int col, unsigned v)=0 |
virtual void | bind (int col, long v)=0 |
virtual void | bind (int col, unsigned long v)=0 |
virtual void | bind (int col, long long v)=0 |
virtual void | bind (int col, unsigned long long v)=0 |
virtual void | bind (int col, double v)=0 |
virtual void | bind (int col, long double v)=0 |
virtual void | bind_null (int col)=0 |
virtual long long | sequence_last (std::string const &sequence)=0 |
virtual unsigned long long | affected ()=0 |
virtual result * | query ()=0 |
virtual void | exec ()=0 |
This class represents a statement that can be either executed or queried for result.
virtual unsigned long long cppdb::backend::statement::affected | ( | ) | [pure virtual] |
Return the number of affected rows by last statement.
Should be called after exec(), otherwise behavior is undefined.
virtual void cppdb::backend::statement::bind | ( | int | col, |
std::string const & | |||
) | [pure virtual] |
Bind a text value to column col (starting from 1). You may assume that the reference remains valid until real call of query() or exec()
Should throw invalid_placeholder() if the value of col is out of range. May ignore if it is impossible to know whether the placeholder exists without special support from back-end.
virtual void cppdb::backend::statement::bind | ( | int | col, |
char const * | s | ||
) | [pure virtual] |
Bind a text value to column col (starting from 1). You may assume that the reference remains valid until real call of query() or exec()
Should throw invalid_placeholder() if the value of col is out of range. May ignore if it is impossible to know whether the placeholder exists without special support from back-end.
virtual void cppdb::backend::statement::bind | ( | int | col, |
char const * | b, | ||
char const * | e | ||
) | [pure virtual] |
Bind a text value to column col (starting from 1). You may assume that the reference remains valid until real call of query() or exec()
Should throw invalid_placeholder() if the value of col is out of range. May ignore if it is impossible to know whether the placeholder exists without special support from back-end.
virtual void cppdb::backend::statement::bind | ( | int | col, |
std::tm const & | |||
) | [pure virtual] |
Bind a date-time value to column col (starting from 1).
Should throw invalid_placeholder() if the value of col is out of range. May ignore if it is impossible to know whether the placeholder exists without special support from back-end.
virtual void cppdb::backend::statement::bind | ( | int | col, |
std::istream & | |||
) | [pure virtual] |
Bind a BLOB value to column col (starting from 1).
Should throw invalid_placeholder() if the value of col is out of range. May ignore if it is impossible to know whether the placeholder exists without special support from back-end.
virtual void cppdb::backend::statement::bind | ( | int | col, |
int | v | ||
) | [pure virtual] |
Bind an integer value to column col (starting from 1).
Should throw invalid_placeholder() if the value of col is out of range. May ignore if it is impossible to know whether the placeholder exists without special support from back-end.
virtual void cppdb::backend::statement::bind | ( | int | col, |
unsigned | v | ||
) | [pure virtual] |
Bind an integer value to column col (starting from 1).
Should throw invalid_placeholder() if the value of col is out of range. May ignore if it is impossible to know whether the placeholder exists without special support from back-end.
May throw bad_value_cast() if the value out of supported range by the DB.
virtual void cppdb::backend::statement::bind | ( | int | col, |
long | v | ||
) | [pure virtual] |
Bind an integer value to column col (starting from 1).
Should throw invalid_placeholder() if the value of col is out of range. May ignore if it is impossible to know whether the placeholder exists without special support from back-end.
May throw bad_value_cast() if the value out of supported range by the DB.
virtual void cppdb::backend::statement::bind | ( | int | col, |
unsigned long | v | ||
) | [pure virtual] |
Bind an integer value to column col (starting from 1).
Should throw invalid_placeholder() if the value of col is out of range. May ignore if it is impossible to know whether the placeholder exists without special support from back-end.
May throw bad_value_cast() if the value out of supported range by the DB.
virtual void cppdb::backend::statement::bind | ( | int | col, |
long long | v | ||
) | [pure virtual] |
Bind an integer value to column col (starting from 1).
Should throw invalid_placeholder() if the value of col is out of range. May ignore if it is impossible to know whether the placeholder exists without special support from back-end.
May throw bad_value_cast() if the value out of supported range by the DB.
virtual void cppdb::backend::statement::bind | ( | int | col, |
unsigned long long | v | ||
) | [pure virtual] |
Bind an integer value to column col (starting from 1).
Should throw invalid_placeholder() if the value of col is out of range. May ignore if it is impossible to know whether the placeholder exists without special support from back-end.
May throw bad_value_cast() if the value out of supported range by the DB.
virtual void cppdb::backend::statement::bind | ( | int | col, |
double | v | ||
) | [pure virtual] |
Bind a floating point value to column col (starting from 1).
Should throw invalid_placeholder() if the value of col is out of range. May ignore if it is impossible to know whether the placeholder exists without special support from back-end.
virtual void cppdb::backend::statement::bind | ( | int | col, |
long double | v | ||
) | [pure virtual] |
Bind a floating point value to column col (starting from 1).
Should throw invalid_placeholder() if the value of col is out of range. May ignore if it is impossible to know whether the placeholder exists without special support from back-end.
virtual void cppdb::backend::statement::bind_null | ( | int | col | ) | [pure virtual] |
Bind a NULL value to column col (starting from 1).
Should throw invalid_placeholder() if the value of col is out of range. May ignore if it is impossible to know whether the placeholder exists without special support from back-end.
virtual void cppdb::backend::statement::exec | ( | ) | [pure virtual] |
Execute a statement, MAY throw cppdb_error if the statement returns results.
virtual result* cppdb::backend::statement::query | ( | ) | [pure virtual] |
Return SQL Query result, MAY throw cppdb_error if the statement is not a query
virtual void cppdb::backend::statement::reset | ( | ) | [pure virtual] |
virtual long long cppdb::backend::statement::sequence_last | ( | std::string const & | sequence | ) | [pure virtual] |
Fetch the last sequence generated for last inserted row. May use sequence as parameter if the database uses sequences, should ignore the parameter sequence if the last id is fetched without parameter.
Should be called after exec() for insert statement, otherwise the behavior is undefined.
MUST throw not_supported_by_backend() if such option is not supported by the DB engine.
virtual std::string const& cppdb::backend::statement::sql_query | ( | ) | [pure virtual] |
Get the query the statement works with. Return it as is, used as key for statement caching