mariadb get warning count: 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 LoadVehicle()
    local query = mariadb_prepare(sql, "SELECT * FROM vehicles WHERE id = 1;")
    mariadb_async_query(sql, query, OnLoadVehicle)
end
 
function OnLoadVehicle()
    local warnings = mariadb_get_warning_count()
    print("This query had"..warnings.." warnings")
end
</syntaxhighlight>
</syntaxhighlight>


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

Latest revision as of 08:48, 2 September 2020

mariadb get warning count

Type: Function
Context: Server
Introduced: v1.0

NOTICE

This function is provided by the official MariaDB plugin.

Description

Returns the number of warnings the sent query generated.

Syntax

mariadb_get_warning_count()

Parameters

  • This function has no parameters.

Return Value

  • Number of warnings, false on error.

Example

function LoadVehicle()
    local query = mariadb_prepare(sql, "SELECT * FROM vehicles WHERE id = 1;")
    mariadb_async_query(sql, query, OnLoadVehicle)
end

function OnLoadVehicle()
    local warnings = mariadb_get_warning_count()
    print("This query had"..warnings.." warnings")
end

See also