Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Phinx/Db/Adapter/MysqlAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1419,8 +1419,8 @@ public function hasDatabase(string $name): bool
{
$rows = $this->fetchAll(
sprintf(
'SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = \'%s\'',
$name,
'SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = %s',
$this->getConnection()->quote($name),
),
);

Expand Down
1 change: 1 addition & 0 deletions src/Phinx/Db/Adapter/PostgresAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,7 @@ public function createDatabase(string $name, array $options = []): void
*/
public function hasDatabase(string $name): bool
{
$name = $this->getConnection()->quote($name);
$sql = sprintf("SELECT count(*) FROM pg_database WHERE datname = '%s'", $name);
$result = $this->fetchRow($sql);

Expand Down
4 changes: 2 additions & 2 deletions src/Phinx/Db/Adapter/SqlServerAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1198,8 +1198,8 @@ public function hasDatabase(string $name): bool
/** @var array<string, mixed> $result */
$result = $this->fetchRow(
sprintf(
"SELECT count(*) as [count] FROM master.dbo.sysdatabases WHERE [name] = '%s'",
$name,
"SELECT count(*) as [count] FROM master.dbo.sysdatabases WHERE [name] = %s",
$this->getConnection()->quote($name),
),
);

Expand Down
Loading