aboutsummaryrefslogtreecommitdiff
path: root/odb
diff options
context:
space:
mode:
Diffstat (limited to 'odb')
-rw-r--r--odb/pgsql/statement.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/odb/pgsql/statement.cxx b/odb/pgsql/statement.cxx
index 68c9ace..e4bea6d 100644
--- a/odb/pgsql/statement.cxx
+++ b/odb/pgsql/statement.cxx
@@ -355,6 +355,8 @@ namespace odb
bool insert_statement::
execute ()
{
+ id_cached_ = false;
+
bind_param (native_data_, data_);
result_ptr r (PQexecPrepared (conn_.handle (),
@@ -380,13 +382,15 @@ namespace odb
translate_error (conn_, h);
}
- id_cached_ = false;
return true;
}
unsigned long long insert_statement::
id ()
{
+ if (id_cached_)
+ return id_;
+
result_ptr r (PQexecParams (conn_.handle (),
"select lastval ()",
0, 0, 0, 0, 0, 1));