This commit is contained in:
2021-07-06 18:00:01 +08:00
parent ec00c2d104
commit 12766a3b74
+4 -4
View File
@@ -735,16 +735,16 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
} }
if (str_starts_with($table, $tablePrefix)) { if (str_starts_with($table, $tablePrefix)) {
return '`' . static::getDbName() . '`' . $table; return '`' . static::getDbName() . '`.' . $table;
} else if (!str_starts_with($table, '{{%')) { } else if (!str_starts_with($table, '{{%')) {
return '`' . static::getDbName() . '`' . $table; return '`' . static::getDbName() . '`.' . $table;
} }
$table = trim($table, '{{%}}'); $table = trim($table, '{{%}}');
if ($tablePrefix) { if ($tablePrefix) {
$table = '`' . static::getDbName() . '`' . $tablePrefix . $table; $table = '`' . static::getDbName() . '`.' . $tablePrefix . $table;
} }
return '`' . static::getDbName() . '`' . $table; return '`' . static::getDbName() . '`.' . $table;
} }