Page 1 of 1

SqlMonitor don't log parameters values

Posted: 10.09.2008, 23:30
by lams
Hi,

I am using ZeosLib 6.63 under D6 SP1 under WinXP.

The SqlMonitor works fine for me. The only issue is that it don't log the query parameters values. Is this by designed?

Because in .Net side, I am using nhibernate and log4net, it's very handy to trace sql log with query and parameters.

Cheers,

Tao

Posted: 11.09.2008, 09:20
by mdaems
Not really 'like designed'. The query sent to the server is logged 'as is' by design. I suppose 'nobody' else before thought about also logging the bind phase for a prepared statement. This is a known issue for databases really supporting prepared statements. For databases where zeoslib emulates prepared statements this is not an issue as the query is expanded automatically.

Now we're thinking about introducing real prepared statement support we will have to add a log line for the bind values anyway. You may be the one to do it.

First step: add lcBindPrepStmt to

Code: Select all

TZLoggingCategory = (lcConnect, lcDisconnect, lcTransaction, lcExecute, lcOther, lcPrepStmt, lcExecPrepStmt);
in ZDbcLogging.pas.

Then search for the implementation of the functions ExecuteQueryPrepared, ExecuteUpdatePrepared, ExecutePrepared of the IZPreparedStatement implementations for all databases. For implementations not substituting the parameters in the sql statement there should be 3 log lines. lcPrepStmt instead of the current lcExecute (containing the sql statement), lcBindPrepStmt after the binds have been done (containing something like 'param_a:5, param_b:'a string', param_c:(BLOB)' and finally lcExecPrepStmt after a succesfull execute.

Mark

Posted: 11.09.2008, 22:03
by lams
Thanks for your quick reply, Mark. I will try it out next week as I am busy other project at the moment.

By the way, what's the Url of the Zeoslib svn? I think the sourceforge cvs is very old.

Cheers,

Tao

Posted: 12.09.2008, 09:33
by mdaems
Hi lams,

Have a look at the 'How to use our svn repository' tutorial.

The url is : svn://firmos.at/zeos/ . Make sure you use testing branch when you want to send code patches ( svn://firmos.at/zeos/branches/testing/ ). This branch is where all new development is added before moving to trunk. Unless for documentation or cosmetic changes, it should take at least a week before changes are propagated to trunk (and eventually 6.6-patches branch).

Mark