Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Parse PHP or Perl and Reconstruct MySQL Schema

by TedPride (Priest)
on Jun 04, 2006 at 21:02 UTC ( [id://553506]=note: print w/replies, xml ) Need Help??


in reply to Parse PHP or Perl and Reconstruct MySQL Schema

All you can do is get a list of all the queries used; sort out and arrange the queries into sets of fields for each table; then assign a type for each field based on (a) its name and (b) the form fields that feed data to it. For instance, if a field is named addr1 and the form field is <input type="text" name="addr1" size="50" maxlength="100"> and you want to make it fixed-width, the logical size is 100 characters. If on the other hand the field is named ltime, you'll have to go into the code and check context to decide which type of form field to use.

The database driver idea probably won't work by itself, since many user-run queries are based on the data that's already being displayed, and if it's not being displayed, then you won't get any queries. This is something to look at if the first method fails, though I'd personally just write a small PHP routine to log calls, then rewrite the query lines to require / call this routine. Turning off the logging later will just be a matter of removing the part of the routine that does the logging. Any monkey can do this in under an hour by reading through the necessary part of the PHP documentation, writing a simple routine, then doing a find on all the PHP files for mysql_query and replacing those lines.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://553506]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-24 06:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found