summaryrefslogtreecommitdiff
path: root/vendor/fguillot/picodb/lib/PicoDb/Driver
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/fguillot/picodb/lib/PicoDb/Driver')
-rw-r--r--vendor/fguillot/picodb/lib/PicoDb/Driver/Mysql.php4
-rw-r--r--vendor/fguillot/picodb/lib/PicoDb/Driver/Postgres.php7
-rw-r--r--vendor/fguillot/picodb/lib/PicoDb/Driver/Sqlite.php8
3 files changed, 17 insertions, 2 deletions
diff --git a/vendor/fguillot/picodb/lib/PicoDb/Driver/Mysql.php b/vendor/fguillot/picodb/lib/PicoDb/Driver/Mysql.php
index 147be816..17f44057 100644
--- a/vendor/fguillot/picodb/lib/PicoDb/Driver/Mysql.php
+++ b/vendor/fguillot/picodb/lib/PicoDb/Driver/Mysql.php
@@ -102,6 +102,10 @@ class Mysql extends Base
$options[PDO::ATTR_PERSISTENT] = $settings['persistent'];
}
+ if (! empty($settings['timeout'])) {
+ $options[PDO::ATTR_TIMEOUT] = $settings['timeout'];
+ }
+
if (isset($settings['verify_server_cert'])) {
$options[PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = $settings['verify_server_cert'];
}
diff --git a/vendor/fguillot/picodb/lib/PicoDb/Driver/Postgres.php b/vendor/fguillot/picodb/lib/PicoDb/Driver/Postgres.php
index 94279492..86036839 100644
--- a/vendor/fguillot/picodb/lib/PicoDb/Driver/Postgres.php
+++ b/vendor/fguillot/picodb/lib/PicoDb/Driver/Postgres.php
@@ -42,6 +42,7 @@ class Postgres extends Base
$dsn = 'pgsql:dbname='.$settings['database'];
$username = null;
$password = null;
+ $options = array();
if (! empty($settings['username'])) {
$username = $settings['username'];
@@ -59,7 +60,11 @@ class Postgres extends Base
$dsn .= ';port='.$settings['port'];
}
- $this->pdo = new PDO($dsn, $username, $password);
+ if (! empty($settings['timeout'])) {
+ $options[PDO::ATTR_TIMEOUT] = $settings['timeout'];
+ }
+
+ $this->pdo = new PDO($dsn, $username, $password, $options);
if (isset($settings['schema_table'])) {
$this->schemaTable = $settings['schema_table'];
diff --git a/vendor/fguillot/picodb/lib/PicoDb/Driver/Sqlite.php b/vendor/fguillot/picodb/lib/PicoDb/Driver/Sqlite.php
index ea39f007..0503d336 100644
--- a/vendor/fguillot/picodb/lib/PicoDb/Driver/Sqlite.php
+++ b/vendor/fguillot/picodb/lib/PicoDb/Driver/Sqlite.php
@@ -29,7 +29,13 @@ class Sqlite extends Base
*/
public function createConnection(array $settings)
{
- $this->pdo = new PDO('sqlite:'.$settings['filename']);
+ $options = array();
+
+ if (! empty($settings['timeout'])) {
+ $options[PDO::ATTR_TIMEOUT] = $settings['timeout'];
+ }
+
+ $this->pdo = new PDO('sqlite:'.$settings['filename'], null, null, $options);
$this->enableForeignKeys();
}