|
@@ -331,10 +331,10 @@ class Base
|
|
|
list($database, $tableName) = array_pad(explode('.', $table), 2, '');
|
|
|
|
|
|
if ($tableName) {
|
|
|
- $tableName = stristr($tableName, '`') ? $tableName : '`'. $tableName .'`';
|
|
|
+ $tableName = stristr($tableName, '`') || stristr($tableName, " ") ? $tableName : '`'. $tableName .'`';
|
|
|
return "`{$database}`.`{$tableName}`";
|
|
|
}
|
|
|
- $table = stristr($table, '`') ? $table : '`'. $table .'`';
|
|
|
+ $table = stristr($table, '`') || stristr($tableName, " ") ? $table : '`'. $table .'`';
|
|
|
return $table;
|
|
|
}
|
|
|
|
|
@@ -818,7 +818,10 @@ class Base
|
|
|
final function createSelectSQL($table)
|
|
|
{
|
|
|
|
|
|
- if(stristr($table, '.') == false && stristr($table, '`') == false) {
|
|
|
+ if(stristr($table, '.') == false
|
|
|
+ && stristr($table, '`') == false
|
|
|
+ && stristr($table, ' ') == false
|
|
|
+ ) {
|
|
|
$table = '`'. $table .'`';
|
|
|
}
|
|
|
$sql = sprintf($this->_query['SELECT'], ((trim($this->fields) != '') ? $this->fields : "*"), $table) . $this->join . $this->where . $this->groupBy . $this->orderBy . $this->limit;
|