summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/pdo
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2021-12-20 14:47:39 +0100
committerAndrey Andreev <narf@devilix.net>2021-12-20 14:51:13 +0100
commit74384ca7f88913b87e982696bb5cb3eb5593c451 (patch)
tree3a17b60268a1869c6ee42468153a34020c2a11ac /system/database/drivers/pdo
parentd9218efec1d89e9d633b73f367bcc7b676400621 (diff)
Merge pull request #6074 from philsturgeon/ci3-php8
CodeIgniter 3.0 on PHP 8
Diffstat (limited to 'system/database/drivers/pdo')
-rw-r--r--system/database/drivers/pdo/pdo_driver.php8
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php7
2 files changed, 15 insertions, 0 deletions
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index d0a2bf959..b2178b684 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -131,6 +131,14 @@ class CI_DB_pdo_driver extends CI_DB {
$this->options[PDO::ATTR_PERSISTENT] = TRUE;
}
+ // From PHP8.0, default PDO::ATTR_ERRMODE is changed
+ // from PDO::ERRMODE_SILENT to PDO::ERRMODE_EXCEPTION
+ // as https://wiki.php.net/rfc/pdo_default_errmode
+ if ( ! isset($this->options[PDO::ATTR_ERRMODE]))
+ {
+ $this->options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_SILENT;
+ }
+
try
{
return new PDO($this->dsn, $this->username, $this->password, $this->options);
diff --git a/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php b/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php
index 187cb2d09..4c3a5aaea 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php
@@ -54,6 +54,13 @@ class CI_DB_pdo_pgsql_forge extends CI_DB_pdo_forge {
protected $_drop_table_if = 'DROP TABLE IF EXISTS';
/**
+ * CREATE TABLE IF statement
+ *
+ * @var string
+ */
+ protected $_create_table_if = 'CREATE TABLE IF NOT EXISTS';
+
+ /**
* UNSIGNED support
*
* @var array