I’ve created a new piece of code that allows people to grep through their database tables and fields. I regularily work on databases with more than 50 tables in the database. Each table has anywhere from two to twenty fields in them. To make things even more of a pain in the ass sometimes the fields are mispelled or do not match up.
As a result I created mysql_grep.php. You can download it from my newly created source directory. Check back often for more code/utilities created by me. Below is an example use of mysql_grep.php
jstump@zebulon:~$ php -q bin/mysql_grep.php -d joestump_net -e photo
The following fields match "photo"
+-> photos_favorites
+-> photoID
+-> photos_images
+-> photoID
The following tables match "photo"
+-> photos_albums
+-> photos_favorites
+-> photos_images
The code does not support connecting to hosts other than localhost nor does it support changing sockets/ports. Furthermore, the code requires PEAR’s DB. And, finally, the expressions are passed directly to PHP’s ereg(). This means you should be able to pass "^[A-Z]" as an expression (remember to quote your complex expressions).