aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-07-25 14:46:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-07-25 14:46:13 +0200
commit62c19a34f1b32f084845ea51eba9b6fb910ef66b (patch)
treeb903954c6873f52e5da97fb09e94bf1f5b1f8092
parente8b6dc6bad63c84ab48f12a15abe0716c798d3c7 (diff)
Clean up PostgreSQL auto id implementation
Specifically, avoid sending the auto id value.
-rw-r--r--odb/relational/pgsql/context.cxx2
-rw-r--r--odb/relational/pgsql/source.cxx15
2 files changed, 11 insertions, 6 deletions
diff --git a/odb/relational/pgsql/context.cxx b/odb/relational/pgsql/context.cxx
index e8cbabd..bed0d1a 100644
--- a/odb/relational/pgsql/context.cxx
+++ b/odb/relational/pgsql/context.cxx
@@ -80,7 +80,7 @@ namespace relational
generate_grow = true;
need_alias_as = true;
- insert_send_auto_id = true;
+ insert_send_auto_id = false;
delay_freeing_statement_result = false;
need_image_clone = false;
data_->bind_vector_ = "pgsql::bind*";
diff --git a/odb/relational/pgsql/source.cxx b/odb/relational/pgsql/source.cxx
index 26df223..a327b2a 100644
--- a/odb/relational/pgsql/source.cxx
+++ b/odb/relational/pgsql/source.cxx
@@ -22,8 +22,7 @@ namespace relational
struct query_parameters: relational::query_parameters
{
query_parameters (base const& x)
- : base (x),
- i_ (0)
+ : base (x), i_ (0)
{
}
@@ -39,7 +38,6 @@ namespace relational
virtual string
auto_id ()
{
- ++i_;
return "DEFAULT";
}
@@ -128,8 +126,15 @@ namespace relational
// generating. See object_columns in common source generator for
// details.
//
- if ((id () || readonly (member_path_, member_scope_)) &&
- sk_ == statement_update)
+ if (id ())
+ {
+ if (sk_ == statement_update ||
+ (sk_ == statement_insert && auto_ (m)))
+ return false;
+ }
+
+ if (sk_ == statement_update &&
+ readonly (member_path_, member_scope_))
return false;
if ((sk_ == statement_insert || sk_ == statement_update) &&