world.DatabaseLastInsertRowid

MUSHclient script function (Method) — introduced in version 4.40

Returns the most recently automatically allocated database key

Prototype

BSTR DatabaseLastInsertRowid(BSTR DbName);

Data type meanings

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

Database (SQLite)

See also

FunctionDescription
DatabaseChangesReturns a count of the changes to the database by the most recent SQL statement
DatabaseExecExecutes SQL code against an SQLite database
DatabaseStepExecutes a previously-prepared SQL statement
DatabaseTotalChangesReturns a count of the total changes to the database