From c7690dd7afac4711466851bc493825d713479de0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 25 Jul 2012 14:46:12 +0200 Subject: Clean up PostgreSQL auto id implementation Specifically, avoid sending the auto id value. --- odb/pgsql/simple-object-statements.hxx | 14 ++++++++------ 1 file 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; -- cgit v1.1