[Phpmyadmin-devel] SQL Pretty printer

Michal Čihař michal at cihar.com
Fri Aug 19 06:45:31 CEST 2011


Hi

Dne Thu, 18 Aug 2011 13:40:42 +0300
Tyron Madlener <tyronx at gmail.com> napsal(a):

> On Thu, Aug 18, 2011 at 1:02 PM, Michal Čihař <michal at cihar.com> wrote:
> > Hi
> >
> > Dne Wed, 17 Aug 2011 20:45:44 +0300
> > Tyron Madlener <tyronx at 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

Looks good, merged.

Thanks-- 
	Michal Čihař | http://cihar.com | http://phpmyadmin.cz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20110819/40f27c4e/attachment.sig>


More information about the Developers mailing list