Arithmetic support in rules
	Braces support in rules
	Changed wildcard character to '@'
This commit is contained in:
f0o
2014-12-19 20:20:17 +00:00
parent aeccdbb942
commit 7ec262760c

View File

@@ -34,7 +34,7 @@ function GenSQL($rule) {
if( strstr($opt,'%') && strstr($opt,'.') ) {
$tmpp = explode(".",$opt,2);
$tmpp[0] = str_replace("%","",$tmpp[0]);
$tables[] = mres($tmpp[0]);
$tables[] = mres(str_replace("(","",$tmpp[0]));
$rule = str_replace($opt,$tmpp[0].'.'.$tmpp[1],$rule);
}
}
@@ -48,7 +48,7 @@ function GenSQL($rule) {
}
$i++;
}
$sql = "SELECT * FROM ".implode(",",$tables)." WHERE (".$join."".$tables[0].".device_id = ?) && (".str_replace(array("*","!~","~"),array("%","NOT LIKE","LIKE"),$rule).")";
$sql = "SELECT * FROM ".implode(",",$tables)." WHERE (".$join."".str_replace("(","",$tables[0]).".device_id = ?) && (".str_replace(array("%","@","!~","~"),array("","%","NOT LIKE","LIKE"),$rule).")";
return $sql;
}