mariadb get warning count: 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_get_warning_count(..."
 
No edit summary
 
(2 intermediate revisions 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 number of warnings the sent query generated.}}


{{FuncSyntax|mariadb_get_warning_count()}}
{{FuncSyntax|mariadb_get_warning_count()}}
Line 9: Line 9:
{{FuncNoParam}}
{{FuncNoParam}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|Number of warnings, '''false''' on error.}}


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


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
{{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