Skip to content

Commit 6a6a0f2

Browse files
committed
feat: add the validation.
1 parent 349f996 commit 6a6a0f2

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

system/Database/SQLSRV/Builder.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,16 @@ private function getFullName(string $table): string
291291

292292
if ($this->db->escapeChar === '"') {
293293
if (str_contains($table, '.')) {
294-
$dbInfo = explode('.', $table);
295-
$database = str_replace('"', '', $dbInfo[0]);
296-
$schema = str_replace('"', '', $dbInfo[1]);
297-
$tableName = str_replace('"', '', $dbInfo[2]);
294+
$dbInfo = explode('.', $table);
295+
$database = $this->db->getDatabase();
296+
$schema = $this->db->schema;
297+
$table = $dbInfo[0];
298+
299+
if (isset($dbInfo[1], $dbInfo[2])) {
300+
$database = str_replace('"', '', $dbInfo[0]);
301+
$schema = str_replace('"', '', $dbInfo[1]);
302+
$tableName = str_replace('"', '', $dbInfo[2]);
303+
}
298304

299305
return '"' . $database . '"."' . $schema . '"."' . str_replace('"', '', $tableName) . '"' . $alias;
300306
}

0 commit comments

Comments
 (0)