diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-09-29 09:01:46 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-09-29 09:01:46 +0200 |
commit | 63884d028d25114263f53fbc8c2025003b8900c9 (patch) | |
tree | eb72b2c912206549b47eec4d0bb57a36ae75b7a8 | |
parent | ec1683514402dfed20b8a08824e2aa1bb017d6e7 (diff) |
Add assertion for mismatch of result set column count
This is useful for detecting native views that happen to have stray data
members.
-rw-r--r-- | odb/oracle/statement.cxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/odb/oracle/statement.cxx b/odb/oracle/statement.cxx index f923da6..21e976b 100644 --- a/odb/oracle/statement.cxx +++ b/odb/oracle/statement.cxx @@ -411,13 +411,15 @@ namespace odb if (!done_) free_result (); + OCIError* err (conn_.error_handle ()); + // @@ Retrieve a single row into the already bound output buffers as an // optimization? This will avoid multiple server round-trips in the case // of a single object load. // sword r (OCIStmtExecute (conn_.handle (), stmt_, - conn_.error_handle (), + err, 0, 0, 0, @@ -425,7 +427,17 @@ namespace odb OCI_DEFAULT)); if (r == OCI_ERROR || r == OCI_INVALID_HANDLE) - translate_error (conn_.error_handle (), r); + translate_error (err, r); + +#ifndef NDEBUG + ub4 n (0); + r = OCIAttrGet(stmt_, OCI_HTYPE_STMT, &n, 0, OCI_ATTR_PARAM_COUNT, err); + + if (r == OCI_ERROR || r == OCI_INVALID_HANDLE) + translate_error (err, r); + + assert (n == data_.count); +#endif } select_statement::result select_statement:: |