diff options
| -rw-r--r-- | drivers/adodb-pdo.inc.php | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/adodb-pdo.inc.php b/drivers/adodb-pdo.inc.php index 075e9189..8ee8bb31 100644 --- a/drivers/adodb-pdo.inc.php +++ b/drivers/adodb-pdo.inc.php @@ -86,7 +86,14 @@ 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 __construct() { } @@ -148,8 +155,16 @@ 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; |
