mariadb error

From Onset Developer Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
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