summaryrefslogtreecommitdiff
path: root/drivers/adodb-pdo.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/adodb-pdo.inc.php')
-rw-r--r--drivers/adodb-pdo.inc.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/adodb-pdo.inc.php b/drivers/adodb-pdo.inc.php
index 89ca0451..0f9fb653 100644
--- a/drivers/adodb-pdo.inc.php
+++ b/drivers/adodb-pdo.inc.php
@@ -85,6 +85,13 @@ class ADODB_pdo extends ADOConnection {
var $dsnType = '';
var $stmt = false;
var $_driver;
+
+ /*
+ * Describe parameters passed directly to the PDO driver
+ *
+ * @example $db->pdoOptions = [\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION];
+ */
+ public $pdoParameters = array();
function _UpdatePDO()
{
@@ -145,8 +152,17 @@ class ADODB_pdo extends ADOConnection {
$argDSN .= ';dbname='.$argDatabasename;
}
}
+ /*
+ * Configure for persistent connection if required,
+ * by adding the the pdo parameter into any provided
+ * ones
+ */
+ if ($persist) {
+ $this->pdoParameters[\PDO::ATTR_PERSISTENT] = true;
+ }
+
try {
- $this->_connectionID = new PDO($argDSN, $argUsername, $argPassword);
+ $this->_connectionID = new \PDO($argDSN, $argUsername, $argPassword, $this->pdoParameters);
} catch (Exception $e) {
$this->_connectionID = false;
$this->_errorno = -1;