Forum

Kognitio Console issues, advice, etc.
Contributor
Offline
Posts: 183
Joined: Wed May 29, 2013 2:10 pm
Location: Bracknell

Writing all executed SQL in a script to a file

by MikeAtkinson » Tue May 16, 2017 4:50 pm

Looking through old feature requests for Console I came across one to add the ability to log all SQL statements executed within a script to a file. It turns out this is easy to do with KogScript.

Code: Select all

local x = sql
logfile = "C:/TEMP/script.log";
function sql(s)
    local f = assert(io.open(logfile, "a+"))
    f:write(s .. "\n")
    f:close()
    x(s)
end

select * from ipe_user;
Because KogScript uses the global function sql() to execute SQL we just replace it with another function of the same name, which also adds the logging.
Reply with quote Top

Who is online

Users browsing this forum: No registered users and 1 guest

cron