diff options
Diffstat (limited to 'odb/oracle/statement.hxx')
-rw-r--r-- | odb/oracle/statement.hxx | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/odb/oracle/statement.hxx b/odb/oracle/statement.hxx index 5bbd3af..6520c31 100644 --- a/odb/oracle/statement.hxx +++ b/odb/oracle/statement.hxx @@ -165,6 +165,9 @@ namespace odb std::size_t batch, auto_handle<OCIError>* status); + // Call OCIStmtExecute() and set up the batch tracking variables (see + // below). + // sword execute (std::size_t n, multiple_exceptions*); @@ -303,7 +306,7 @@ namespace odb binding& param, binding* returning); - // Return the number of rows (out of n) that were attempted. + // Return the number of parameter sets (out of n) that were attempted. // std::size_t execute (std::size_t n = 1, multiple_exceptions* = 0); @@ -390,22 +393,44 @@ namespace odb virtual ~delete_statement (); + // OCI does not expose individual affected row counts for batch + // operations. Instead, it adds them all up and returns a single + // count. This is bad news for us. + // + // In case of deleting by primary key (the affected row count is + // either 1 or 0), we can recognize the presumably successful case + // where the total affected row count is equal to the batch size + // (we can also recognize the "all unsuccessful" case where the + // total affected row count is 0). The unique_hint argument in the + // constructors below indicates whether this is a "0 or 1" DELETE + // statement. + // + // In all other situations (provided this is a batch), the result() + // function below returns the special result_unknown value. + // delete_statement (connection_type& conn, const std::string& text, - binding& param); + binding& param, + bool unique_hint = false); delete_statement (connection_type& conn, const char* text, - binding& param); + binding& param, + bool unique_hint = false); - // Return the number of parameter rows (out of n) that were attempted. + // Return the number of parameter sets (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. + // set. If this is a batch (n > 1 in execute() call above) and it + // is impossible to determine the affected row count for each + // parameter set, then this function returns result_unknown. All + // other errors are reported by throwing exceptions. // + static const unsigned long long result_unknown = ~0ULL; + unsigned long long result (std::size_t i = 0); @@ -418,6 +443,7 @@ namespace odb fetch (sword r, OCIError*); private: + bool unique_; unsigned long long result_; }; } |