mariadb error: 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_error(handle_id)}}...")
 
No edit summary
 
(One intermediate revision by the same 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|Get's the last error message (if any) as a string.}}


{{FuncSyntax|mariadb_error(handle_id)}}
{{FuncSyntax|mariadb_error(handle_id)}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|handle_id|__EDIT_ME__}}
{{FuncParam|handle_id|Connection handle.}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|Last error message as a string. If there is none then it will return '''false'''.}}


== 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  = mariadb_error(sql)
    print("Error: ", error)
end
</syntaxhighlight>


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

Latest revision as of 09:18, 2 September 2020

mariadb error

Type: Function
Context: Server
Introduced: v1.0

NOTICE

This function is provided by the official MariaDB plugin.

Description

Get's the last error message (if any) as a string.

Syntax

mariadb_error(handle_id)

Parameters

  • handle_id
    Connection handle.

Return Value

  • Last error message as a string. If there is none then it will return false.

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  = mariadb_error(sql)
    print("Error: ", error)
end

See also