webmcp
diff framework/env/trace/sql.lua @ 295:1fbdccf4f8e9
Always enable SQL tracer (within framework/env/__init.lua); Record execution time of SQL statements
author | jbe |
---|---|
date | Sun Mar 22 18:40:07 2015 +0100 (2015-03-22) |
parents | 0bbfee4d4aed |
children | fe9ea7a03364 |
line diff
1.1 --- a/framework/env/trace/sql.lua Sun Mar 22 17:33:37 2015 +0100 1.2 +++ b/framework/env/trace/sql.lua Sun Mar 22 18:40:07 2015 +0100 1.3 @@ -1,7 +1,8 @@ 1.4 --[[-- 1.5 trace.sql{ 1.6 - command = command, -- executed SQL command as string 1.7 - error_position = error_position -- optional position in bytes where an error occurred 1.8 + command = command, -- executed SQL command as string 1.9 + execution_time = execution_time, -- execution time of the statement in seconds 1.10 + error_position = error_position -- optional position in bytes where an error occurred 1.11 } 1.12 1.13 This command can be used to log SQL command execution. It is currently not invoked automatically. 1.14 @@ -13,10 +14,14 @@ 1.15 function trace.sql(args) 1.16 if not trace._disabled then 1.17 local command = args.command 1.18 + local execution_time = args.execution_time 1.19 local error_position = args.error_position 1.20 if type(command) ~= "string" then 1.21 error("No command string passed to trace.sql{...}.") 1.22 end 1.23 + if type(execution_time) ~= "number" then 1.24 + error("No execution time number passed to trace.sql{...}.") 1.25 + end 1.26 if error_position and type(error_position) ~= "number" then 1.27 error("error_position must be a number.") 1.28 end