Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Location
    Brighton, UK
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Code highlight & format SQL queries (looking for feedback)

    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

    Here are two example queries (although not valid SQL, they demonstrate the functionality), and an image of the output from my script:

    Code:
    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)


    Cheers!

  • #2
    Senior Coder
    Join Date
    Aug 2003
    Location
    One step ahead of you.
    Posts
    2,815
    Thanks
    0
    Thanked 3 Times in 3 Posts
    You can't DL it from that site.
    Edit: Wow I found it

    BTW: http://qbnz.com/highlighter/
    I'm not sure if this was any help, but I hope it didn't make you stupider.

    Experience is something you get just after you really need it.
    PHP Installation Guide Feedback welcome.

  • #3
    Regular Coder
    Join Date
    Mar 2005
    Location
    Brighton, UK
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That other script is good, but it only highlights the code, it dosent format it with line breaks and tabs etc, but thanks for the link.

    Anyway, the purpose of that program and the purpose of my scripts are different. Their program is just for hilighting code, to print out or display on a web page I guess. My script is part of a larger class called PHP Dump, which is for quickly debugging things like arrays and queries, and it displays them in an easy to read way. Basically an enhanced version of var_dump.

    The idea of my SQL formatting is if you have a query with an error, you can quicky parse the query string through the dump function and inspect it.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •