MySQL Syntax Highlight - Pretty Print from phpMyAdmin
Posted: Thu Mar 27, 2008 6:31 am
Hi everyone
I've been trawling around looking for a PHP class/function that will provide syntax highlighting for MySQL queries.
The best example I've seen of syntax highlight is in phpMyAdmin, I've not managed to find anything out there even close to that.
I had a dig through the source code of phpMyAdmin to see if it's something I could extract but it seems to be tied in with various libraries that phpMyAdmin uses, I tried extracting the function but it just failed.
I think I need to extract the whole phpMyAdmin SQL parser to use the syntax highlight functionality - which is fine, as this MySQL syntax highlight will only be used rarely by certain users as the basis of an 'advanced mysql search' script I'm creating.
It seems from the pMA source that it refers to the functions as "pretty print"
Has anyone else had any luck in extracting this library out to utilise pMA's pretty print syntax highlighting for MySQL?
Or can anyone take a brief look though the source and see which bits/libraries I need to extract? People with more PHP experience might be able to fathom the code out a bit better.
Thanks, Ben
I've been trawling around looking for a PHP class/function that will provide syntax highlighting for MySQL queries.
The best example I've seen of syntax highlight is in phpMyAdmin, I've not managed to find anything out there even close to that.
I had a dig through the source code of phpMyAdmin to see if it's something I could extract but it seems to be tied in with various libraries that phpMyAdmin uses, I tried extracting the function but it just failed.
I think I need to extract the whole phpMyAdmin SQL parser to use the syntax highlight functionality - which is fine, as this MySQL syntax highlight will only be used rarely by certain users as the basis of an 'advanced mysql search' script I'm creating.
It seems from the pMA source that it refers to the functions as "pretty print"
Has anyone else had any luck in extracting this library out to utilise pMA's pretty print syntax highlighting for MySQL?
Or can anyone take a brief look though the source and see which bits/libraries I need to extract? People with more PHP experience might be able to fathom the code out a bit better.
Thanks, Ben