aspiritus wrote:
Hello all experts !

I need to log every INSERT, UPDATE and DELETE queries even when using
placeholders. Here some code:

$sql = "UPDATE users SET `name`=? WHERE ìd`=1;";
$sth = $dbh->prepare($sql);
$sth->execute('Test User');
$sth->finish();

Of course execute params are given dynamically and I want to use
placeholders for more secure code.
I want to save that UPDATE query into file or database ( I'll prefer
DB :) ) for tracking purposes. Any idea how to do this?



DBIx::Log4perl will do this and more. Log4perl supports logging to files and databases and a lot more and DBIx::Log4perl can be inserted wherever you use DBI very easily. Whether the format will be how you want it is another question but as I have an interest in DBIx::Log4perl I would be happy to hear your suggestions.

Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com

Reply via email to