Logo Search packages:      
Sourcecode: qt4-x11 version File versions

QVariant QSqlQuery::lastInsertId (  )  const

Returns the object ID of the most recent inserted row if the database supports it. An invalid QVariant will be returned if the query did not insert any value or if the database does not report the id back. If more than one row was touched by the insert, the behavior is undefined.

Note that for Oracle databases the row's ROWID will be returned, while for MySQL databases the row's auto-increment field will be returned.

See also:

Definition at line 1123 of file qsqlquery.cpp.

    return d->sqlResult->lastInsertId();

Generated by  Doxygen 1.6.0   Back to index