aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-07-05 14:13:01 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-07-05 14:13:01 +0200
commit1d3edf0de34c311014fd222a737e96c9f1d5b83a (patch)
tree884970ea59174cfaabb74bf2a5437d8624587c04
parent9134d603584241135be03ce2e9f2f66a46c44fc6 (diff)
Only bind native binding structure when references are present
-rw-r--r--odb/pgsql/query.cxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/odb/pgsql/query.cxx b/odb/pgsql/query.cxx
index 36a624b..1c5f9d4 100644
--- a/odb/pgsql/query.cxx
+++ b/odb/pgsql/query.cxx
@@ -257,7 +257,7 @@ namespace odb
if (n == 0)
return native_binding_;
- bool inc_ver (false);
+ bool ref (false), inc_ver (false);
binding& r (binding_);
bind* b (&bind_[0]);
@@ -267,6 +267,8 @@ namespace odb
if (p.reference ())
{
+ ref = true;
+
if (p.init ())
{
p.bind (b + i);
@@ -275,10 +277,14 @@ namespace odb
}
}
- if (inc_ver)
- r.version++;
+ if (ref)
+ {
+ statement::bind_param (native_binding_, binding_);
+
+ if (inc_ver)
+ r.version++;
+ }
- statement::bind_param (native_binding_, binding_);
return native_binding_;
}