summaryrefslogtreecommitdiff
path: root/libpqpp/connection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libpqpp/connection.cpp')
-rw-r--r--libpqpp/connection.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/libpqpp/connection.cpp b/libpqpp/connection.cpp
index e41cd3b..98f9054 100644
--- a/libpqpp/connection.cpp
+++ b/libpqpp/connection.cpp
@@ -186,3 +186,14 @@ PQ::Connection::bulkUploadData(const char * data, size_t len) const
}
}
+int64_t
+PQ::Connection::insertId() const
+{
+ SelectCommand getId(this, "SELECT lastval()", pstmntNo++);
+ int64_t id = -1;
+ while (getId.fetch()) {
+ getId[0] >> id;
+ }
+ return id;
+}
+