Skip to content

Commit 8f82e4e

Browse files
committed
use query bindings instead of sprintf()
1 parent 366c240 commit 8f82e4e

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

system/Database/Forge.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ private function databaseExists(string $dbName): bool
279279

280280
return false;
281281
}
282-
283-
return $this->db->query(sprintf($this->checkDatabaseExistStr, $this->db->escape($dbName)))->getRow() !== null;
282+
283+
return $this->db->query($this->checkDatabaseExistStr, $dbName)->getRow() !== null;
284284
}
285285

286286
//--------------------------------------------------------------------

system/Database/Postgre/Forge.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Forge extends \CodeIgniter\Database\Forge
4949
*
5050
* @var string
5151
*/
52-
protected $checkDatabaseExistStr = 'SELECT 1 FROM pg_database WHERE datname = %s';
52+
protected $checkDatabaseExistStr = 'SELECT 1 FROM pg_database WHERE datname = ?';
5353

5454
/**
5555
* DROP CONSTRAINT statement

0 commit comments

Comments
 (0)