SqlMonitor don't log parameters values

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
lams
Fresh Boarder
Fresh Boarder
Posts: 22
Joined: 13.08.2008, 04:24

SqlMonitor don't log parameters values

Post 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
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
lams
Fresh Boarder
Fresh Boarder
Posts: 22
Joined: 13.08.2008, 04:24

Post 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
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
Post Reply