world.DatabaseLastInsertRowid
Returns the most recently automatically allocated database key
Prototype
BSTR DatabaseLastInsertRowid(BSTR DbName);
Description
This returns a string which is the most recent automatically allocated database key (for example, if you are using autoincrement on the primary key). Internally it is a 64-bit number, but since there is no ready mechanism for returning 64-bit numbers via the scripting interface, MUSHclient converts it to a string, and returns that.
Lua example
last_key = DatabaseLastInsertRowid ("db")
Return value
A string which is the most recently-allocated key. May be zero if there is no such key.
Related topic
See also
| Function | Description |
|---|---|
| DatabaseChanges | Returns a count of the changes to the database by the most recent SQL statement |
| DatabaseExec | Executes SQL code against an SQLite database |
| DatabaseStep | Executes a previously-prepared SQL statement |
| DatabaseTotalChanges | Returns a count of the total changes to the database |