Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cppdb/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,16 @@ namespace cppdb {
///
virtual bool fetch(int col,std::tm &v) = 0;
///
virtual bool fetch(int col,bool &v) = 0;
///
/// Check if the column \a col is NULL starting from 0, should throw invalid_column() if the index out of range
///
virtual bool is_null(int col) = 0;
///
/// Return the number of columns in the result. Should be valid even without calling next() first time.
///
virtual int data_type(int col) = 0;
///
virtual int cols() = 0;
///
/// Return the number of columns by its name. Return -1 if the name is invalid
Expand Down Expand Up @@ -276,12 +280,15 @@ namespace cppdb {
///
virtual void bind(int col,std::istream &) = 0;
///
virtual void bind(int col,bool) = 0;
///
/// Bind an integer value to column \a 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 bind(int col,int v) = 0;
///
/// Bind an integer value to column \a col (starting from 1).
Expand Down
28 changes: 27 additions & 1 deletion cppdb/frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,15 @@ namespace cppdb {
///
bool is_null(std::string const &n);

///
/// Return data type (oid) of column number \a col (starting from 0)
///
int data_type(int col);
///
/// Return data type (oid) of column named \a n
///
int data_type(std::string const &n);

///
/// Clears the result, no further use of the result should be done until it is assigned again with a new statement result.
///
Expand Down Expand Up @@ -349,6 +358,9 @@ namespace cppdb {
/// If the data type is not blob, it may throw bad_value_cast()
///
bool fetch(int col,std::ostream &v);
///
///
bool fetch(int col,bool &v);

///
/// Fetch a value from column named \a n into \a v. Returns false
Expand Down Expand Up @@ -420,7 +432,9 @@ namespace cppdb {
/// the \a n value is invalid throws invalid_column exception
///
bool fetch(std::string const &n,std::ostream &v);

///
///
bool fetch(std::string const &n,bool &v);

///
/// Fetch a value from the next column in the row starting from the first one. Returns false
Expand Down Expand Up @@ -481,6 +495,9 @@ namespace cppdb {
/// automatically.
///
bool fetch(std::ostream &v);
///
///
bool fetch(bool &v);

///
/// Get a value of type \a T from column named \a name. If the column
Expand Down Expand Up @@ -723,6 +740,9 @@ namespace cppdb {
///
statement &bind(std::istream &v);
///
///
statement &bind(bool v);
///
/// Bind a NULL value to the next placeholder marked with '?' marker in the query.
///
/// If number of calls is higher then the number placeholders is the statement it
Expand Down Expand Up @@ -814,6 +834,9 @@ namespace cppdb {
///
void bind(int col,std::istream &v);
///
///
void bind(int col,bool v);
///
/// Bind a NULL value to the placeholder number \a col (starting from 1) marked with '?' marker in the query.
///
/// If \a cols is invalid (less then 1 or higher then the number of the placeholders is the statement) it
Expand Down Expand Up @@ -895,6 +918,9 @@ namespace cppdb {
///
statement &operator<<(std::istream &v);
///
///
statement &operator<<(bool v);
///
/// Apply manipulator on the statement, same as manipulator(*this).
///
statement &operator<<(void (*manipulator)(statement &st));
Expand Down
Loading