On Thu, Aug 18, 2011 at 1:02 PM, Michal Čihař michal@cihar.com wrote:
Hi
Dne Wed, 17 Aug 2011 20:45:44 +0300 Tyron Madlener tyronx@gmail.com napsal(a):
Ok I just added this behavior myself. We just need a new css class for this now. Maybe it makes sense to give statements verbs a different color, let's say blue? Or better just the same keyword color?
I think it should stay consistent with PHP parser/highlighter, so see $GLOBALS['cfg']['SQP']['fmtColor'] for possible types.
I've just added a css rule for this with using the same as 'keyword' for now.
I've also took the liberty to fix up the matching of multipart keywords such as "insert into", "group by". Those are now identified as one keyword instead of both being identified individually.
And the reason for these 2 changes is because I've now implemented a sql pretty printer using the codemirror/mysql-mode tokenizer. This replaces the bunch of regex's that I used earlier to pretty print queries in the query analyzer dialog, since they fail in many cases. The new implementation should now pretty print any query correctly, including subqueries. I could need some more test data though.
I've added this feature in the form of PMA_SQLPrettyPrint() in functions.js - maybe we use it for the sql query editor as well?
Here's a screenshot of how it looks like: http://www.tyron.at/tmp/prettyprinter.png