Remove now obsoleted naive glue-checks

This commit is contained in:
f0o
2015-11-30 19:13:32 +00:00
parent b14d094d83
commit ae3f893351
+18 -25
View File
@@ -59,35 +59,28 @@ function GenSQL($rule) {
$join = "";
while( $i < $x ) {
if( isset($tables[$i+1]) ) {
if( dbFetchCell('SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_NAME = ? && COLUMN_NAME = ?',array($tables[$i+1],'device_id')) == 1 ) {
//Found valid glue in definition.
$join .= $tables[$i].".device_id = ".$tables[$i+1].".device_id && ";
$gtmp = ResolveGlues(array($tables[$i+1]),'device_id');
if( $gtmp === false ) {
//Cannot resolve glue-chain. Rule is invalid.
return false;
}
else {
//No valid glue, Resolve a glue-chain.
$gtmp = ResolveGlues(array($tables[$i+1]),'device_id');
if( $gtmp === false ) {
//Cannot resolve glue-chain. Rule is invalid.
return false;
$last = "";
$qry = "";
foreach( $gtmp as $glue ) {
if( empty($last) ) {
list($tmp,$last) = explode('.',$glue);
$qry .= $glue.' = ';
}
$last = "";
$qry = "";
foreach( $gtmp as $glue ) {
if( empty($last) ) {
list($tmp,$last) = explode('.',$glue);
$qry .= $glue.' = ';
}
else {
list($tmp,$new) = explode('.',$glue);
$qry .= $tmp.'.'.$last.' && '.$tmp.'.'.$new.' = ';
$last = $new;
}
if( !in_array($tmp, $tables) ) {
$tables[] = $tmp;
}
else {
list($tmp,$new) = explode('.',$glue);
$qry .= $tmp.'.'.$last.' && '.$tmp.'.'.$new.' = ';
$last = $new;
}
if( !in_array($tmp, $tables) ) {
$tables[] = $tmp;
}
$join .= "( ".$qry.$tables[0].".device_id ) && ";
}
$join .= "( ".$qry.$tables[0].".device_id ) && ";
}
$i++;
}