aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-07-25 15:52:26 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-07-25 15:52:26 +0200
commit6600ffb83cc88ab8b34d9fc7754656c95b0355e3 (patch)
tree3fb9aa5448fbf711a43391c1ceb7b47ec44e20e6
parent5d4af1156c6d10fc675394f3c0becb4889f8ff3d (diff)
Simplify auto id implementation in Oracle
Specifically, instead of using a trigger to assign the next id from the sequence, get the next value directly in the INSERT statement.
-rw-r--r--odb/oracle/simple-object-statements.hxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/odb/oracle/simple-object-statements.hxx b/odb/oracle/simple-object-statements.hxx
index 20cfffe..dfaf8c4 100644
--- a/odb/oracle/simple-object-statements.hxx
+++ b/odb/oracle/simple-object-statements.hxx
@@ -414,21 +414,23 @@ namespace odb
public:
// select = total
- // insert = total - inverse - managed_optimistic
+ // insert = total - inverse - managed_optimistic - auto_id
// update = total - inverse - managed_optimistic - id - readonly
//
static const std::size_t select_column_count =
object_traits::column_count;
+ static const std::size_t id_column_count =
+ object_traits::id_column_count;
+
static const std::size_t insert_column_count =
object_traits::column_count - object_traits::inverse_column_count -
- object_traits::managed_optimistic_column_count;
+ object_traits::managed_optimistic_column_count -
+ (object_traits::auto_id ? id_column_count : 0);
static const std::size_t update_column_count = insert_column_count -
- object_traits::id_column_count - object_traits::readonly_column_count;
-
- static const std::size_t id_column_count =
- object_traits::id_column_count;
+ (object_traits::auto_id ? 0 : id_column_count) -
+ object_traits::readonly_column_count;
static const std::size_t managed_optimistic_column_count =
object_traits::managed_optimistic_column_count;