diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-09-08 09:23:47 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-09-08 09:23:47 +0200 |
commit | 071fe5eef8d88ac51d4ed6436aa2ffc95283ae5b (patch) | |
tree | 2d60538d7ee28cef0adfb4269a59a51b83c4f74f /odb/oracle/statement.hxx | |
parent | 46d3996ac44abe5fac0de5d1510d1d733ba50e7c (diff) |
Implement SQLite style select statement interface
Diffstat (limited to 'odb/oracle/statement.hxx')
-rw-r--r-- | odb/oracle/statement.hxx | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/odb/oracle/statement.hxx b/odb/oracle/statement.hxx index 8dfaa3f..6e183a8 100644 --- a/odb/oracle/statement.hxx +++ b/odb/oracle/statement.hxx @@ -74,26 +74,55 @@ namespace odb void execute (); - // Number of rows already fetched. + result + fetch () + { + return next () ? load () : no_data; + } + + // Never need to deal with truncation, so this is a dummy function. // - std::size_t - fetched () const + void + refetch () { - return rows_; } + void + free_result (); + + // More fine-grained Oracle-specific interface that splits fetch() into + // next() and load(). + // + public: + // Return false if there is no more rows. You should call next() until it + // returns false or, alternatively, call free_result (). Otherwise, the + // statement will remain unfinished. + // + bool + next (); + result - fetch (); + load () + { + if (done_) + return no_data; + + return success; + } + // Never need to deal with truncation, so this is a dummy function. + // void - free_result (); + reload () + { + } private: select_statement (const select_statement&); select_statement& operator= (const select_statement&); private: - bool end_; + bool done_; std::size_t rows_; }; |