diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2014-11-13 13:54:29 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2014-11-13 13:54:29 +0200 |
commit | 6d29dfc7d766482cbe5578d662041431bd3d6dc9 (patch) | |
tree | 4e9bb379a06e2b018b868194fc73e43c827e927e /odb/oracle/statement.ixx | |
parent | 58c6088dc3c75f0fd631714541349068f5986239 (diff) |
Bulk update implementation
Diffstat (limited to 'odb/oracle/statement.ixx')
-rw-r--r-- | odb/oracle/statement.ixx | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/odb/oracle/statement.ixx b/odb/oracle/statement.ixx index a41da8a..f1cdb75 100644 --- a/odb/oracle/statement.ixx +++ b/odb/oracle/statement.ixx @@ -8,6 +8,8 @@ namespace odb { namespace oracle { + // bulk_statement + // inline bulk_statement:: bulk_statement (connection_type& c, const std::string& text, @@ -15,7 +17,7 @@ namespace odb const binding* process, bool optimize, std::size_t batch, - auto_handle<OCIError>* status) + sb4* status) : statement (c, text, k, process, optimize), status_ (batch == 1 ? 0 : status) { @@ -28,10 +30,34 @@ namespace odb const binding* process, bool optimize, std::size_t batch, - auto_handle<OCIError>* status) + sb4* status) : statement (c, text, k, process, optimize), status_ (batch == 1 ? 0 : status) { } + + // insert_statement + // + inline void insert_statement:: + fetch (sword r, sb4 code) + { + result_ = true; + + if (r != 0) // OCI_SUCCESS + { + // An auto-assigned object id should never cause a duplicate primary + // key. + // + if (ret_ == 0) + { + // The Oracle error code ORA-00001 indicates unique constraint + // violation, which covers more than just a duplicate primary key. + // Unfortunately, there is nothing more precise that we can use. + // + if (code == 1) + result_ = false; + } + } + } } } |