diff --git a/system/Database/SQLSRV/Builder.php b/system/Database/SQLSRV/Builder.php index baa4e0406c7f..c1b61947c90d 100755 --- a/system/Database/SQLSRV/Builder.php +++ b/system/Database/SQLSRV/Builder.php @@ -295,18 +295,16 @@ private function getFullName(string $table): string $database = $this->db->getDatabase(); $table = $dbInfo[0]; - if (count($dbInfo) >= 2 && isset($dbInfo[1])) { - if (count($dbInfo) === 3 && isset($dbInfo[2])) { - $database = str_replace('"', '', $dbInfo[0]); - $schema = str_replace('"', '', $dbInfo[1]); - $tableName = str_replace('"', '', $dbInfo[2]); - } else { - $schema = str_replace('"', '', $dbInfo[0]); - $tableName = str_replace('"', '', $dbInfo[1]); - } - - return '"' . $database . '"."' . $schema . '"."' . str_replace('"', '', $tableName) . '"' . $alias; + if (count($dbInfo) === 3) { + $database = str_replace('"', '', $dbInfo[0]); + $schema = str_replace('"', '', $dbInfo[1]); + $tableName = str_replace('"', '', $dbInfo[2]); + } else { + $schema = str_replace('"', '', $dbInfo[0]); + $tableName = str_replace('"', '', $dbInfo[1]); } + + return '"' . $database . '"."' . $schema . '"."' . str_replace('"', '', $tableName) . '"' . $alias; } return '"' . $this->db->getDatabase() . '"."' . $this->db->schema . '"."' . str_replace('"', '', $table) . '"' . $alias;