Friday, February 09, 2007

OQL Queries

We finally have queries for the objects in the database. They're used with the macro #@select.

An example:
$r =& #@select RolePermission (permission as permission) from p: RolePermission, u:UserRole where p.role =u.role AND u.user=$id@#;
And the complete grammar:
'<oql( condition="subexpression=">"\(",<expression>,"\)"|comparison=><value>,"=|<=|>=|LIKE",<value>.
expression::=logical=><condition>,operator->"AND|OR|and|or",<condition>|condition=><condition>.
oql::=class->["[a-zA-Z_][a-zA-Z_0-9]*"],
fields->["\(",fields->{"[a-zA-Z_][a-zA-Z_0-9]*","as","[a-zA-Z_][a-zA-Z_0-9]*";","},"\)"],
from->["from",from->{var->"[a-zA-Z_][a-zA-Z_0-9]*",":",class->"[a-zA-Z_][a-zA-Z_0-9]*";","}],
where->["where",expression-><expression>].
variable::={"[a-zA-Z_][a-zA-Z_0-9]*";"\."}.
value::=var=><variable>|
value=>(number=>"[0-9]+"|
str=>"\'[^\']\'"|
phpvar=>"\$[a-zA-Z_][a-zA-Z_0-9]*"|
bool=>"TRUE|FALSE|True|False|true|false").
)>'

Labels: ,

0 Comments:

Post a Comment

<< Home