aboutsummaryrefslogtreecommitdiff
path: root/odb/oracle/simple-object-statements.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2014-11-13 13:54:29 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2014-11-13 13:54:29 +0200
commit6d29dfc7d766482cbe5578d662041431bd3d6dc9 (patch)
tree4e9bb379a06e2b018b868194fc73e43c827e927e /odb/oracle/simple-object-statements.hxx
parent58c6088dc3c75f0fd631714541349068f5986239 (diff)
Bulk update implementation
Diffstat (limited to 'odb/oracle/simple-object-statements.hxx')
-rw-r--r--odb/oracle/simple-object-statements.hxx27
1 files changed, 17 insertions, 10 deletions
diff --git a/odb/oracle/simple-object-statements.hxx b/odb/oracle/simple-object-statements.hxx
index de82c53..18e4270 100644
--- a/odb/oracle/simple-object-statements.hxx
+++ b/odb/oracle/simple-object-statements.hxx
@@ -276,10 +276,7 @@ namespace odb
// Object image.
//
image_type&
- image (std::size_t i = 0)
- {
- return image_[i];
- }
+ image (std::size_t i = 0) {return images_[i].obj;}
// Insert binding.
//
@@ -323,7 +320,7 @@ namespace odb
// Object id image and binding.
//
id_image_type&
- id_image (std::size_t i = 0) {return id_image_[i];}
+ id_image (std::size_t i = 0) {return images_[i].id;}
std::size_t
id_image_version () const {return id_image_version_;}
@@ -383,7 +380,8 @@ namespace odb
new (details::shared) update_statement_type (
conn_,
object_traits::update_statement,
- object_traits::versioned, // Process if versioned.
+ true, // Unique (0 or 1).
+ object_traits::versioned, // Process if versioned.
update_image_binding_));
return *update_;
@@ -425,7 +423,7 @@ namespace odb
extra_statement_cache ()
{
return extra_statement_cache_.get (
- conn_, image_, id_image_binding_, od_.id_image_binding ());
+ conn_, images_[0].obj, id_image_binding_, od_.id_image_binding ());
}
public:
@@ -475,8 +473,18 @@ namespace odb
extra_statement_cache_ptr<extra_statement_cache_type, image_type>
extra_statement_cache_;
- image_type image_[object_traits::batch];
- auto_handle<OCIError> status_[object_traits::batch];
+ // The UPDATE statement uses both the object and id image. Keep
+ // them next to each other so that the same skip distance can
+ // be used in batch binding.
+ //
+ struct images
+ {
+ image_type obj;
+ id_image_type id;
+ };
+
+ images images_[object_traits::batch];
+ sb4 status_[object_traits::batch];
// Select binding.
//
@@ -508,7 +516,6 @@ namespace odb
// Id image binding (only used as a parameter or in RETURNING for
// auto ids). Uses the suffix in the update bind.
//
- id_image_type id_image_[object_traits::batch];
std::size_t id_image_version_;
binding id_image_binding_;