This topic is locked

Search all tables in your database with a single query!

8/23/2011 2:32:56 PM
PHPRunner Tips and Tricks
F
FunkDaddy author

I recently downloaded and installed tera-wurfl (a mobile device detection "package") which created a database with over 14,000 device user-agent strings with their hardware capabilities. This is a wonderful tool, however, while testing different user agents in FireFox (using "user agent switcher" extension) I came across some device types identified by wurfl but couldn't find them in any obvious table locations (since tera-wurfl version generates 45 different tables and prepends them with manufacturer/brand names).
For example I was testing a Palm Pre/Pixi user agent (WebOS) and wurfl would identify it correctly, however there is no table named "Palm" or "HP" or "WebOS"... thus, trying to find the device manually in those tables (without the wurfl script) was very difficult. At first I thought about simply creating a custom query for all 45 tables using the UNION ALL statement, but quickly realized this would be tedious as well as require updates once wurfl decided to add new tables in future updates.
Long story short... I found this awesome script that allows you to search accross all tables and fields in your database with one simple command. Its a PHP script/project called "Anywhereindb" and it's hosted on Google Code, here: http://code.google.com/p/anywhereindb/
You simply download it, run the script in your browser, give it the db connection info, then search. It's incredibly fast and efficient.
If you want to get creative you could easily adapt that script and incorporate it into your PHPR project if needed; or simply use it as I did for quick searches outside of your project needs.
Cheers,

Admin 8/24/2011

Marcelo,
nice find! I'll if we can adapt it to support all databases and also provide tighter integration with PHPRunner. Support for project tables only comes to mind first. Search only fields that are marked as searchable, output data manner similar to the rest of project etc.