mariadb get query exec time: 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_query_exec_tim..."
 
No edit summary
 
(One intermediate revision 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|Gets the time in milliseconds how long this query took to execute.}}


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


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|Returns the execution time in milliseconds.}}


== 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 time = mariadb_get_query_exec_time()
    print("Query took: "..time.."ms")
end
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
{{MariaDBFunctions}}

Latest revision as of 08:46, 2 September 2020

mariadb get query exec time

Type: Function
Context: Server
Introduced: v1.0

NOTICE

This function is provided by the official MariaDB plugin.

Description

Gets the time in milliseconds how long this query took to execute.

Syntax

mariadb_get_query_exec_time()

Parameters

  • This function has no parameters.

Return Value

  • Returns the execution time in milliseconds.

Example

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

function OnLoadVehicle()
    local time = mariadb_get_query_exec_time()
    print("Query took: "..time.."ms")
end

See also