db: added insert_id()

Database::insert_id() retrieves the auto-generated ID from the last INSERT
or UPDATE on a table containing an AUTO_INCREMENT column.

Change-Id: I6ec94d1820bb7e77bd37df33145caa93016fd328
This commit is contained in:
Horst Schirmeier
2013-07-15 13:36:11 +02:00
parent 5a5ef61fa5
commit cbbd0ec764
2 changed files with 9 additions and 0 deletions

View File

@ -73,6 +73,10 @@ my_ulonglong Database::affected_rows()
return mysql_affected_rows(handle);
}
my_ulonglong Database::insert_id()
{
return mysql_insert_id(handle);
}
std::vector<Database::Variant> Database::get_variants(const std::string &variant, const std::string &benchmark) {
std::vector<Variant> result;

View File

@ -85,6 +85,11 @@ namespace fail {
*/
my_ulonglong affected_rows();
/**
* AUTO_INCREMENT id from the last INSERT or UPDATE statement.
*/
my_ulonglong insert_id();
/**
* Interface to the util/CommandLine.hpp interface. In you
* application you first call cmdline_setup(), which adds