aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-07-25 14:46:12 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-07-25 14:46:12 +0200
commitc7690dd7afac4711466851bc493825d713479de0 (patch)
tree24644ebe4e83eb354b61b7ac11efa9d9bd27cedd
parent42fd8756a1785e94f4ab948291316830f77bcf4b (diff)
Clean up PostgreSQL auto id implementation
Specifically, avoid sending the auto id value.
-rw-r--r--odb/pgsql/simple-object-statements.hxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/odb/pgsql/simple-object-statements.hxx b/odb/pgsql/simple-object-statements.hxx
index cba8598..d3938f4 100644
--- a/odb/pgsql/simple-object-statements.hxx
+++ b/odb/pgsql/simple-object-statements.hxx
@@ -437,21 +437,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;