webmcp
diff framework/env/trace/sql.lua @ 0:9fdfb27f8e67
Version 1.0.0
author | jbe/bsw |
---|---|
date | Sun Oct 25 12:00:00 2009 +0100 (2009-10-25) |
parents | |
children | 0bbfee4d4aed |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/framework/env/trace/sql.lua Sun Oct 25 12:00:00 2009 +0100 1.3 @@ -0,0 +1,27 @@ 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 +} 1.9 + 1.10 +This command can be used to log SQL command execution. It is currently not invoked automatically. 1.11 + 1.12 +--]]-- 1.13 + 1.14 +-- TODO: automatic use of this function? 1.15 + 1.16 +function trace.sql(args) 1.17 + local command = args.command 1.18 + local error_position = args.error_position 1.19 + if type(command) ~= "string" then 1.20 + error("No command string passed to trace.sql{...}.") 1.21 + end 1.22 + if error_position and type(error_position) ~= "number" then 1.23 + error("error_position must be a number.") 1.24 + end 1.25 + trace._new_entry{ 1.26 + type = "sql", 1.27 + command = command, 1.28 + error_position = error_position 1.29 + } 1.30 +end