rework of patch #879693 to support 0=1 in where clause

This commit is contained in:
brianb
2004-02-08 21:54:20 +00:00
parent 4a56f06da9
commit fed589b2e7
11 changed files with 129 additions and 64 deletions

View File

@@ -49,6 +49,7 @@ static MdbSQL *g_sql;
%type <name> constant
%type <ival> operator
%type <ival> nulloperator
%type <name> identifier
%%
@@ -89,22 +90,30 @@ sarg_list:
;
sarg:
NAME operator constant {
identifier operator constant {
mdb_sql_add_sarg(_mdb_sql(NULL), $1, $2, $3);
free($1);
free($3);
}
| constant operator NAME {
| constant operator identifier {
mdb_sql_add_sarg(_mdb_sql(NULL), $3, $2, $1);
free($1);
free($3);
}
| NAME nulloperator {
| constant operator constant {
mdb_sql_eval_expr(_mdb_sql(NULL), $1, $2, $3);
}
| identifier nulloperator {
mdb_sql_add_sarg(_mdb_sql(NULL), $1, $2, NULL);
free($1);
}
;
identifier:
NAME
| IDENT
;
operator:
'=' { $$ = MDB_EQUAL; }
| '>' { $$ = MDB_GT; }