webmcp
view framework/env/trace/sql.lua @ 242:f66037207da8
Skip application based initializers in interactive mode
| author | jbe | 
|---|---|
| date | Sun Mar 01 16:23:39 2015 +0100 (2015-03-01) | 
| parents | 0bbfee4d4aed | 
| children | 1fbdccf4f8e9 | 
 line source
     1 --[[--
     2 trace.sql{
     3   command        = command,        -- executed SQL command as string
     4   error_position = error_position  -- optional position in bytes where an error occurred
     5 }
     7 This command can be used to log SQL command execution. It is currently not invoked automatically.
     9 --]]--
    11 -- TODO: automatic use of this function?
    13 function trace.sql(args)
    14   if not trace._disabled then
    15     local command = args.command
    16     local error_position = args.error_position
    17     if type(command) ~= "string" then
    18       error("No command string passed to trace.sql{...}.")
    19     end
    20     if error_position and type(error_position) ~= "number" then
    21       error("error_position must be a number.")
    22     end
    23     trace._new_entry{
    24       type = "sql",
    25       command = command,
    26       error_position = error_position
    27     }
    28   end
    29 end
