Is there a script or class for PHP to parse the insert values from a mysql dump file? I wrote a script that massages data from an export. I want to parse all the values to do some conformance testing, and I wonder if that problem’s already been solved.
For instance, in the dump file, I have
INSERT INTO table ( field1, field2, ... ) VALUES ( "a", "B", ...);
and I want to extract
a
B
to test those values and see that they’re what I think they should be.
I also need this to be able to handle the extended inserts format, which is VALUES ( "a", "B", ...), ( "c", "D", ...), ( "e", "F", ...),.
php-sql-parser should do what you want. Here’s a link to its manual:
http://code.google.com/p/php-sql-parser/wiki/ParserManual