Jak-S
01-06-2006, 10:51 AM
Hey,
I’ve written a script that is basically a much enhanced version of var_dump, any way, that’s not what this posts about.
I have just added a new feature to the script which can code highlight (in various colours) and format SQL Queries (the query string not the result). I wrote it because I often have dynamically generated queries that don’t work and I need to inspect, and this script makes it much easier to look through the query to find mistakes.
I am looking for people to test it out, give me some feedback and generally let me know what they think. Any feedback will be greatly appreciated. Please note that the script only supports the SQL clauses and operators that I used while testing, I know the clause lists aren’t complete, its something I will be adding, however that doesn’t stop you seeing how it all works. If anyone wants to help out completing the lists, feel free :-) .
Script: Here (http://www.reallyshiny.com/scripts/php-dump/)
Here are two example queries (although not valid SQL, they demonstrate the functionality), and an image of the output from my script:
SELECT id, title, content, datePosted, status, MAX(comments) AS maxComments FROM blog WHERE status = 1 AND comments > 5 ORDER BY datePosted DESC LIMIT 0, 5
INSERT INTO blog (title, content, status) VALUES ('Test Article', 'Test test test test test', 1)
http://www.reallyshiny.com/assets/images/content/phpDump-query.gif
Cheers! :)
I’ve written a script that is basically a much enhanced version of var_dump, any way, that’s not what this posts about.
I have just added a new feature to the script which can code highlight (in various colours) and format SQL Queries (the query string not the result). I wrote it because I often have dynamically generated queries that don’t work and I need to inspect, and this script makes it much easier to look through the query to find mistakes.
I am looking for people to test it out, give me some feedback and generally let me know what they think. Any feedback will be greatly appreciated. Please note that the script only supports the SQL clauses and operators that I used while testing, I know the clause lists aren’t complete, its something I will be adding, however that doesn’t stop you seeing how it all works. If anyone wants to help out completing the lists, feel free :-) .
Script: Here (http://www.reallyshiny.com/scripts/php-dump/)
Here are two example queries (although not valid SQL, they demonstrate the functionality), and an image of the output from my script:
SELECT id, title, content, datePosted, status, MAX(comments) AS maxComments FROM blog WHERE status = 1 AND comments > 5 ORDER BY datePosted DESC LIMIT 0, 5
INSERT INTO blog (title, content, status) VALUES ('Test Article', 'Test test test test test', 1)
http://www.reallyshiny.com/assets/images/content/phpDump-query.gif
Cheers! :)