aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRobin Krahl <me@robin-krahl.de>2015-07-25 18:54:06 +0200
committerRobin Krahl <me@robin-krahl.de>2015-07-25 18:54:06 +0200
commit6a00fdf8076537def530e635fbd2a6bbb1827094 (patch)
tree57380e590ceb511388badfd9b2998c79f27ea762 /include
parente04b08fdf55e6e964f6fc2198b882d07ee463456 (diff)
downloadsqlitepp-6a00fdf8076537def530e635fbd2a6bbb1827094.tar.gz
sqlitepp-6a00fdf8076537def530e635fbd2a6bbb1827094.tar.bz2
Add lastInsertRowId, minor improvements.
Diffstat (limited to 'include')
-rw-r--r--include/sqlitepp/sqlitepp.h11
1 files changed, 11 insertions, 0 deletions
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