I am looking to parse INSERT and UPDATE MySQL SQL queries in PHP to determine what changes where made from what original data. Now this would be pretty easy to create, but I want to see if there are any existing libraries in PHP to do this.
Basically what I have is a table with all of the above queries that have been run on a database. I have already separated out the table name and type of query. I am looking to create a full change log for user viewing based on this data, so I need to get the values of the original INSERT and then changes that are made in each UPDATE. In the end I need field name and new value and with the record id(s). I'll do the rest of the checking/beautifying, including the column name to human readable and if a field value hasn't actually changed.
At the moment, I probably don't need to do multiple table UPDATE's, but it would be useful.
What libraries are there to do this?
http://pear.php.net/package/SQL_Parser
http://sourceforge.net/projects/txtsql
http://code.google.com/p/php-sql-parser
For Perl there's more variety