From 6a00fdf8076537def530e635fbd2a6bbb1827094 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sat, 25 Jul 2015 18:54:06 +0200 Subject: Add lastInsertRowId, minor improvements. --- include/sqlitepp/sqlitepp.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/sqlitepp/sqlitepp.h b/include/sqlitepp/sqlitepp.h index 7ef3726..8e5bc0c 100644 --- a/include/sqlitepp/sqlitepp.h +++ b/include/sqlitepp/sqlitepp.h @@ -387,6 +387,17 @@ class Database : private Uncopyable, public Openable { /// \throws DatabaseError if an error occurred during the execution void execute(const std::string& sql); + /// \brief Returns the row ID of the last element that was inserted. + /// + /// If no entry has been inserted into the database, this method returns + /// zero. + /// + /// \returns the index of the last element inserted into the database or + /// zero + /// \throws std::logic_error if the database is not open + /// \throws DatabaseError if an error occurred during the execution + int lastInsertRowId() const; + /// \brief Opens the given database file. /// /// The given file must either be a valid SQLite3 database file or may not -- cgit v1.2.1