Best way to parse a "query" string...
Posted: Mon Nov 07, 2005 8:50 am
I'm working on a custom query system that needs to be very dynamic.
Right you can create a type of query by adding the querytype array.
So...
$querytype[] = array('select','%COLUMN%','from','%TABLE%','!%WHERE%!','!%COLUMN%!','!%OPERATOR%!','!%VALUE%!');
A % symbol means that it's a special value and must be compared to a list of knowns. A ! symbol means it's optional and is not required.
Am I going about this the right way?
Also, I'm looking for advice on the best way to parse the query string it receives, right now I'm pulling to query into an array by exploding it with spaces.
Any ideas?
Right you can create a type of query by adding the querytype array.
So...
$querytype[] = array('select','%COLUMN%','from','%TABLE%','!%WHERE%!','!%COLUMN%!','!%OPERATOR%!','!%VALUE%!');
A % symbol means that it's a special value and must be compared to a list of knowns. A ! symbol means it's optional and is not required.
Am I going about this the right way?
Also, I'm looking for advice on the best way to parse the query string it receives, right now I'm pulling to query into an array by exploding it with spaces.
Any ideas?