mariadb errno: Difference between revisions

From Onset Developer Wiki
28days (talk | contribs)
No edit summary
No edit summary
 
Line 12: Line 12:


== Example ==
== Example ==
<syntaxhighlight lang="Lua>
<syntaxhighlight lang="Lua">
__EDIT_ME__
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>
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
{{Template:MariaDBFunctions}}
{{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