in reply to Parse PHP or Perl and Reconstruct MySQL Schema

It might be possible to get the general structure from such a reverse-engineering DBD, but you probably can't get any type information. One problem I see with your approach is that your average app is expecting to get real data back from DBI and will probably crash early if you can't provide reasonable responses.

A simpler approach would be to scan the code for strings that look like SQL. You could go with the low-tech approach of scanning for strings that begin with select, insert, update, and delete, or use SQL::ReservedWords::MySQL to build a more accurate regex. Then, if you're feeling really ambitious, send the strings through SQL::Statement to pull out the tables and columns.

-sam

  • Comment on Re: Parse PHP or Perl and Reconstruct MySQL Schema