diff options
Diffstat (limited to 'odb/oracle/statement.hxx')
-rw-r--r-- | odb/oracle/statement.hxx | 61 |
1 files changed, 54 insertions, 7 deletions
diff --git a/odb/oracle/statement.hxx b/odb/oracle/statement.hxx index 93213d1..5bbd3af 100644 --- a/odb/oracle/statement.hxx +++ b/odb/oracle/statement.hxx @@ -143,6 +143,38 @@ namespace odb std::size_t usize_; }; + class LIBODB_ORACLE_EXPORT bulk_statement: public statement + { + public: + virtual + ~bulk_statement () = 0; + + bulk_statement (connection_type&, + const std::string& text, + statement_kind, + const binding* process, + bool optimize, + std::size_t batch, + auto_handle<OCIError>* status); + + bulk_statement (connection_type&, + const char* text, + statement_kind, + const binding* process, + bool optimize, + std::size_t batch, + auto_handle<OCIError>* status); + + sword + execute (std::size_t n, multiple_exceptions*); + + protected: + auto_handle<OCIError>* status_; // Row status array. + std::size_t n_; // Actual batch size. + std::size_t i_; // Position in result. + multiple_exceptions* mex_; + }; + class LIBODB_ORACLE_EXPORT generic_statement: public statement { public: @@ -253,7 +285,7 @@ namespace odb select_statement& s_; }; - class LIBODB_ORACLE_EXPORT insert_statement: public statement + class LIBODB_ORACLE_EXPORT insert_statement: public bulk_statement { public: virtual @@ -287,6 +319,8 @@ namespace odb insert_statement& operator= (const insert_statement&); /* + @@ RM + // Only OCI versions 11.2 and greater support conversion of the internal // Oracle type NUMBER to an external 64-bit integer type. If we detect // version 11.2 or greater we provide an unsigned long long image. @@ -323,10 +357,6 @@ namespace odb ub4 ret_size_; // You don't want to know (see statement.cxx). private: - multiple_exceptions* mex_; - std::size_t n_; - std::size_t i_; - auto_handle<OCIError>* status_; bool result_; }; @@ -354,7 +384,7 @@ namespace odb update_statement& operator= (const update_statement&); }; - class LIBODB_ORACLE_EXPORT delete_statement: public statement + class LIBODB_ORACLE_EXPORT delete_statement: public bulk_statement { public: virtual @@ -368,16 +398,33 @@ namespace odb const char* text, binding& param); + // Return the number of parameter rows (out of n) that were attempted. + // + std::size_t + execute (std::size_t n = 1, multiple_exceptions* = 0); + + // Return the number of rows affected (deleted) by the parameter + // row. Errors are reported by throwing exceptions. + // unsigned long long - execute (); + result (std::size_t i = 0); private: delete_statement (const delete_statement&); delete_statement& operator= (const delete_statement&); + + private: + void + fetch (sword r, OCIError*); + + private: + unsigned long long result_; }; } } +#include <odb/oracle/statement.ixx> + #include <odb/post.hxx> #endif // ODB_ORACLE_STATEMENT_HXX |