diff options
-rw-r--r-- | odb/oracle/statement.cxx | 18 | ||||
-rw-r--r-- | odb/oracle/statement.hxx | 9 |
2 files changed, 13 insertions, 14 deletions
diff --git a/odb/oracle/statement.cxx b/odb/oracle/statement.cxx index f4d9eef..c0c0741 100644 --- a/odb/oracle/statement.cxx +++ b/odb/oracle/statement.cxx @@ -1286,9 +1286,7 @@ namespace odb // memset (status_, 0, n * sizeof (status_[0])); - // @@ TODO allocate per batch stmt (maybe lazily here if NULL). - // - auto_handle<OCIError> err1; + if (err1_ == 0) { OCIError* e (0); r = OCIHandleAlloc (conn_.database ().environment (), @@ -1300,7 +1298,7 @@ namespace odb if (r != OCI_SUCCESS) throw invalid_oci_handle (); - err1.reset (e); + err1_.reset (e); } ub4 errors; @@ -1309,10 +1307,10 @@ namespace odb &errors, 0, OCI_ATTR_NUM_DML_ERRORS, - err1); + err1_); if (r == OCI_ERROR || r == OCI_INVALID_HANDLE) - translate_error (err1, r); + translate_error (err1_, r); //cerr << "NUM_DML_ERRORS: " << errors << endl; errors_ = errors; @@ -1341,12 +1339,12 @@ namespace odb OCIError* tmp (err2); r = OCIParamGet (err, // from OCI_HTYPE_ERROR, - err1, // diagnostics + err1_, // diagnostics reinterpret_cast<void**> (&tmp), // to i); if (r == OCI_ERROR || r == OCI_INVALID_HANDLE) - translate_error (err1, r); + translate_error (err1_, r); } ub4 row; @@ -1355,10 +1353,10 @@ namespace odb &row, 0, OCI_ATTR_DML_ROW_OFFSET, - err1); + err1_); if (r == OCI_ERROR || r == OCI_INVALID_HANDLE) - translate_error (err1, r); + translate_error (err1_, r); OCIErrorGet (err2, 1, 0, &status_[row], 0, 0, OCI_HTYPE_ERROR); diff --git a/odb/oracle/statement.hxx b/odb/oracle/statement.hxx index f90efa3..83ce5f7 100644 --- a/odb/oracle/statement.hxx +++ b/odb/oracle/statement.hxx @@ -179,10 +179,11 @@ namespace odb affected (bool unique); protected: - sb4* status_; // Parameter sets status array. - std::size_t n_; // Actual batch size. - std::size_t i_; // Position in result. - std::size_t errors_; // Number of parameter sets that failed. + auto_handle<OCIError> err1_; + sb4* status_; // Parameter sets status array. + std::size_t n_; // Actual batch size. + std::size_t i_; // Position in result. + std::size_t errors_; // Number of parameter sets that failed. multiple_exceptions* mex_; }; |