mariadb errno: 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_errno(handle_id)}}..."
 
No edit summary
 
(One intermediate revision by one other user not shown)
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|Returns the error code of the error message from the previous MariaDB operation.}}


{{FuncSyntax|mariadb_errno(handle_id)}}
{{FuncSyntax|mariadb_errno(handle_id)}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|handle_id|__EDIT_ME__}}
{{FuncParam|handle_id|The mariaDB handle identifier.}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|Error code, '''0''' if no errors occured.}}


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua">
function UpdateVehicles()
    local query = mariadb_prepare(sql, "UPDATE vehicles SET owner = 0 WHERE model = 34;")
    mariadb_async_query(sql, query, OnUpdateVehicles)
end
 
function OnUpdateVehicles()
    local error_num  = mariadb_errno(sql)
    print("Error number: ", error_num )
end
</syntaxhighlight>


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

Latest revision as of 09:19, 2 September 2020

mariadb errno

Type: Function
Context: Server
Introduced: v1.0

NOTICE

This function is provided by the official MariaDB plugin.

Description

Returns the error code of the error message from the previous MariaDB operation.

Syntax

mariadb_errno(handle_id)

Parameters

  • handle_id
    The mariaDB handle identifier.

Return Value

  • Error code, 0 if no errors occured.

Example

function UpdateVehicles()
    local query = mariadb_prepare(sql, "UPDATE vehicles SET owner = 0 WHERE model = 34;")
    mariadb_async_query(sql, query, OnUpdateVehicles)
end

function OnUpdateVehicles()
    local error_num  = mariadb_errno(sql)
    print("Error number: ", error_num )
end

See also