|
Prev: [ANNOUNCEMENT] Net_URL2-0.2.0 (beta) Released.
Next: [ANNOUNCEMENT] PHP_CompatInfo-1.8.0b4 (beta) Released.
From: Charles Mayo on 18 Jun 2008 16:25 Hi All, I'm looking for a way to create a database change log for a contract client's office management system without having to re-code 700+ queries. The change log would record changes made to each record in selected tables, new records created in those tables, the user performing the change (available to me in PHP session variables) and the date and time of the change. It occurred to me that since every query in the system runs through MDB2 there might be some way to use some of MDB2's functionality to accomplish my goal, and I've been looking at MDB2's debug functions, wondering if I could use debug data to keep track of record changes. All I've been able to learn about MDB2's debug function so far is that I can get a list of all queries run by a script. I'm thinking of trying to write some sort of query parser in PHP to ferret out each table and record that's been inserted or updated by a script, run a query to return the modified records and use those results to maintain a change log by comparing each field to previously-recorded values, but writing even a modestly robust query parser in PHP is likely beyond my MySQL skillset, so I'm wondering if perhaps someone more knowledgeable about MDB2 could suggest a better/easier way. Any ideas, suggestions, or pointers would be greatly appreciated. Thanks, Chuck |