[Phpmyadmin-devel] Re: new parser

Robin Johnson robbat2 at fermi.orbis-terrarum.net
Tue Jul 23 15:13:04 CEST 2002


On Tue, 23 Jul 2002, Marc Delisle wrote:

> Hi Robin,
>
> when do you plan to merge it?
The PMA_STR_* stuff is about to be merged.

PMA_SQP_* later on tonight, I need to rewrite a function again.

So that people can give me a hand in updating the existing codebase to use
the new parser, here is an outline of it.

The basic procedure for using the new SQL parser:
On any page that needs to extract data from a query or to pretty-print a
query, you need code like this up at the top:

($sql contains the query)
$parsedSQL = PMA_SQP_Parse($sql);

If you want to extract data from it then, you just need to run
$SQLinfo = PMA_SQP_Analyze($parsedSQL);
(returned structure of this function is being rewritten presently);

If you want a pretty-printed version of the query, do:
$string = PMA_SQP_FormatHTML($parsedSQL);
(note that that you need to have syntax.css.php3 included somehow in your
page for it to work, I recommend '<link rel="stylesheet" type="text/css"
href="syntax.css.php3" />' at the moment.)

-- 
Robin Hugh Johnson
E-Mail     : robbat2 at orbis-terrarum.net
Home Page  : http://www.orbis-terrarum.net/?l=people.robbat2
ICQ#       : 30269588 or 41961639





More information about the Developers mailing list