diff options
author | Florian Pritz <bluewind@xinu.at> | 2021-02-21 11:18:58 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2021-02-21 11:18:58 +0100 |
commit | 08510ba2faa4785339ca7093ba0fa7052ff5d0c8 (patch) | |
tree | 108365fe3624295d70a677642b300fd458e7c569 /system/database/drivers/postgre | |
parent | 29e6c8ad462a426f4bc6d380646e434e3361a21d (diff) | |
parent | 0925b5099919300a239909588351a6482c5e792d (diff) |
PHP8: Merge remote-tracking branch 'upstream/3.1-stable' into dev
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'system/database/drivers/postgre')
4 files changed, 11 insertions, 20 deletions
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 5ce276105..84717d8b5 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Drivers * @category Database * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/database/ + * @link https://codeigniter.com/userguide3/database/ */ class CI_DB_postgre_driver extends CI_DB { @@ -78,22 +78,12 @@ class CI_DB_postgre_driver extends CI_DB { // -------------------------------------------------------------------- /** - * Class constructor + * Build DSN * - * Creates a DSN string to be used for db_connect() and db_pconnect() - * - * @param array $params * @return void */ - public function __construct($params) + protected function _build_dsn() { - parent::__construct($params); - - if ( ! empty($this->dsn)) - { - return; - } - $this->dsn === '' OR $this->dsn = ''; if (strpos($this->hostname, '/') !== FALSE) @@ -149,6 +139,7 @@ class CI_DB_postgre_driver extends CI_DB { */ public function db_connect($persistent = FALSE) { + empty($this->dsn) && $this->_build_dsn(); $this->conn_id = ($persistent === TRUE) ? pg_pconnect($this->dsn) : pg_connect($this->dsn); @@ -428,7 +419,7 @@ class CI_DB_postgre_driver extends CI_DB { { return 'SELECT "column_name" FROM "information_schema"."columns" - WHERE LOWER("table_name") = '.$this->escape(strtolower($table)); + WHERE "table_schema" = \''.$this->schema.'\' AND LOWER("table_name") = '.$this->escape(strtolower($table)); } // -------------------------------------------------------------------- @@ -443,7 +434,7 @@ class CI_DB_postgre_driver extends CI_DB { { $sql = 'SELECT "column_name", "data_type", "character_maximum_length", "numeric_precision", "column_default" FROM "information_schema"."columns" - WHERE LOWER("table_name") = '.$this->escape(strtolower($table)); + WHERE "table_schema" = \''.$this->schema.'\' AND LOWER("table_name") = '.$this->escape(strtolower($table)); if (($query = $this->query($sql)) === FALSE) { diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php index 481e222b8..6f214c665 100644 --- a/system/database/drivers/postgre/postgre_forge.php +++ b/system/database/drivers/postgre/postgre_forge.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Drivers * @category Database * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/database/ + * @link https://codeigniter.com/userguide3/database/ */ class CI_DB_postgre_forge extends CI_DB_forge { @@ -101,7 +101,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @return string|string[] */ protected function _alter_table($alter_type, $table, $field) - { + { if (in_array($alter_type, array('DROP', 'ADD'), TRUE)) { return parent::_alter_table($alter_type, $table, $field); @@ -149,7 +149,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { } return $sqls; - } + } // -------------------------------------------------------------------- diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php index b0054ddae..a0a628f0a 100644 --- a/system/database/drivers/postgre/postgre_result.php +++ b/system/database/drivers/postgre/postgre_result.php @@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Drivers * @category Database * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/database/ + * @link https://codeigniter.com/userguide3/database/ */ class CI_DB_postgre_result extends CI_DB_result { diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php index 450aa36e4..e6e7b28ba 100644 --- a/system/database/drivers/postgre/postgre_utility.php +++ b/system/database/drivers/postgre/postgre_utility.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Drivers * @category Database * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/database/ + * @link https://codeigniter.com/userguide3/database/ */ class CI_DB_postgre_utility extends CI_DB_utility { |