Added database::last_insert_rowid()

This commit is contained in:
Davis King 2013-03-12 18:39:13 -04:00
parent 1290790682
commit c79a34b230
2 changed files with 20 additions and 0 deletions

View File

@ -92,6 +92,12 @@ namespace dlib
const std::string& sql_statement
);
int64 last_insert_rowid (
) const
{
return sqlite3_last_insert_rowid(db.get());
}
private:
friend class statement;

View File

@ -117,6 +117,20 @@ namespace dlib
- executes the supplied SQL statement against this database
!*/
int64 last_insert_rowid (
) const;
/*!
requires
- is_open() == true
ensures
- Each element in a database table has a rowid which uniquely identifies
it. Therefore, this routine returns the rowid of the most recent
successful INSERT into the database via this database instance.
- If an INSERT has not been performed on the current database instance then
the return value is 0. This is true even if the database is not empty.
- See the sqlite documention for the full details on how this function
behaves: http://www.sqlite.org/c3ref/last_insert_rowid.html
!*/
};
// ----------------------------------------------------------------------------------------