* [misc] fix column match error.
This commit is contained in:
@@ -123,7 +123,7 @@ class sqlparser
|
||||
$fromTable = current($this->tables);
|
||||
foreach($this->columns as $columnName => $column)
|
||||
{
|
||||
$column['table'] = array_merge($fromTable, array('column' => $columnName));
|
||||
$column['table'] = array_merge($fromTable, array('column' => $column['origin']));
|
||||
|
||||
$combineColumns[$columnName] = $column;
|
||||
}
|
||||
@@ -163,13 +163,13 @@ class sqlparser
|
||||
/* If it can be matched using an alias, then it returns. */
|
||||
foreach($tables as $table) if($tableName == $table['alias']) return array_merge($table, array('column' => $column));
|
||||
|
||||
$isTable = $table['isTable'];
|
||||
$originTable = $table['originTable'];
|
||||
|
||||
/* 如果匹配不上,则字段没有使用别名进行限制,那么需要通过字段去遍历所有表。*/
|
||||
/* If it doesn't match, then the field is not aliased, and you need to iterate over all tables using the field. */
|
||||
foreach($tables as $table)
|
||||
{
|
||||
$isTable = $table['isTable'];
|
||||
$originTable = $table['originTable'];
|
||||
|
||||
/* 如果是原始表,并且列在原始表中存在,那么返回这个表。*/
|
||||
/* If it is the original table and the column exists in the original table, then the table is returned. */
|
||||
if($isTable && $this->columnExistInOriginTable($originTable, $column)) return array_merge($table, array('column' => $column));
|
||||
|
||||
Reference in New Issue
Block a user