Extract column names from a (my)SQL query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Lets assume I have the following string:
"SELECT field1, field2, field3 FROM tablename WHERE field1 = 'something' "

Is there any way to get "field1, field2, field3"? assuming it might also
have join, left join - things like that.

I can easily do it with preg_match, but I have to make sure its "foolproof".
It would be a lot better if it will also be able to parse the whole query -
catch limit, where, joins, comments....


Is there any php class that could do it?

I've looked in the pear site and on Google but haven't had any luck.

-- 
Use ROT26 for best security

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux