mariadb get insert id: Difference between revisions

From Onset Developer Wiki
(Created page with "{{Info|Function|Server|1.0}} {{Notice|This function is provided by the official MariaDB plugin.}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|mariadb_get_insert_id()}}...")
 
No edit summary
Line 2: Line 2:
{{Notice|This function is provided by the official [[MariaDB]] plugin.}}
{{Notice|This function is provided by the official [[MariaDB]] plugin.}}


{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|Retrieves the ID generated for an AUTO_INCREMENT column by the sent query (usually INSERT).}}


{{FuncSyntax|mariadb_get_insert_id()}}
{{FuncSyntax|mariadb_get_insert_id()}}
Line 9: Line 9:
{{FuncNoParam}}
{{FuncNoParam}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|new ID generated for an AUTO_INCREMENT column, '''false''' on error.}}


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua>
local player_sqlid = mariadb_get_insert_id()
print("A new player with #"..player_sqlid.." has registered.")
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
{{Template:MariaDBFunctions}}

Revision as of 13:53, 20 November 2019

mariadb get insert id

Type: Function
Context: Server
Introduced: v1.0

NOTICE

This function is provided by the official MariaDB plugin.

Description

Retrieves the ID generated for an AUTO_INCREMENT column by the sent query (usually INSERT).

Syntax

mariadb_get_insert_id()

Parameters

  • This function has no parameters.

Return Value

  • new ID generated for an AUTO_INCREMENT column, false on error.

Example

local player_sqlid = mariadb_get_insert_id()
print("A new player with #"..player_sqlid.." has registered.")

See also