webmcp

diff framework/env/trace/sql.lua @ 41:0bbfee4d4aed

New functions trace.disable() and trace.is_disabled()
author jbe
date Sat Oct 16 17:51:18 2010 +0200 (2010-10-16)
parents 9fdfb27f8e67
children 1fbdccf4f8e9
line diff
     1.1 --- a/framework/env/trace/sql.lua	Sat Oct 16 17:49:11 2010 +0200
     1.2 +++ b/framework/env/trace/sql.lua	Sat Oct 16 17:51:18 2010 +0200
     1.3 @@ -11,17 +11,19 @@
     1.4  -- TODO: automatic use of this function?
     1.5  
     1.6  function trace.sql(args)
     1.7 -  local command = args.command
     1.8 -  local error_position = args.error_position
     1.9 -  if type(command) ~= "string" then
    1.10 -    error("No command string passed to trace.sql{...}.")
    1.11 +  if not trace._disabled then
    1.12 +    local command = args.command
    1.13 +    local error_position = args.error_position
    1.14 +    if type(command) ~= "string" then
    1.15 +      error("No command string passed to trace.sql{...}.")
    1.16 +    end
    1.17 +    if error_position and type(error_position) ~= "number" then
    1.18 +      error("error_position must be a number.")
    1.19 +    end
    1.20 +    trace._new_entry{
    1.21 +      type = "sql",
    1.22 +      command = command,
    1.23 +      error_position = error_position
    1.24 +    }
    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
    1.29 -  trace._new_entry{
    1.30 -    type = "sql",
    1.31 -    command = command,
    1.32 -    error_position = error_position
    1.33 -  }
    1.34  end

Impressum / About Us