aboutsummaryrefslogtreecommitdiff
path: root/odb/relational/pgsql/source.cxx
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 /odb/relational/pgsql/source.cxx
parente8b6dc6bad63c84ab48f12a15abe0716c798d3c7 (diff)
Clean up PostgreSQL auto id implementation
Specifically, avoid sending the auto id value.
Diffstat (limited to 'odb/relational/pgsql/source.cxx')
-rw-r--r--odb/relational/pgsql/source.cxx15
1 files changed, 10 insertions, 5 deletions
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) &&