From 0d578171feed5e09afc258346c183cf905333f4a Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Wed, 14 Feb 2018 10:18:27 -0800 Subject: Add timeout parameter for database connection --- vendor/composer/installed.json | 84 +++++++++++----------- vendor/fguillot/picodb/lib/PicoDb/Driver/Mysql.php | 4 ++ .../fguillot/picodb/lib/PicoDb/Driver/Postgres.php | 7 +- .../fguillot/picodb/lib/PicoDb/Driver/Sqlite.php | 8 ++- 4 files changed, 59 insertions(+), 44 deletions(-) (limited to 'vendor') diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index d702ddd7..1326ba84 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -291,48 +291,6 @@ "description": "Simple Json-RPC client/server library that just works", "homepage": "https://github.com/fguillot/JsonRPC" }, - { - "name": "fguillot/picodb", - "version": "v1.0.16", - "version_normalized": "1.0.16.0", - "source": { - "type": "git", - "url": "https://github.com/fguillot/picoDb.git", - "reference": "03b89d09e283cbaffbb4039e4ba6eaa3d327002a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/fguillot/picoDb/zipball/03b89d09e283cbaffbb4039e4ba6eaa3d327002a", - "reference": "03b89d09e283cbaffbb4039e4ba6eaa3d327002a", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": "4.8.*" - }, - "time": "2018-01-30T00:01:16+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-0": { - "PicoDb": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Frédéric Guillot", - "homepage": "https://github.com/fguillot/" - } - ], - "description": "Minimalist database query builder", - "homepage": "https://github.com/fguillot/picoDb" - }, { "name": "fguillot/simple-queue", "version": "v1.0.1", @@ -1079,5 +1037,47 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com" + }, + { + "name": "fguillot/picodb", + "version": "v1.0.17", + "version_normalized": "1.0.17.0", + "source": { + "type": "git", + "url": "https://github.com/fguillot/picoDb.git", + "reference": "1699864992c40ad02395e95d7fbf44a571a116f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fguillot/picoDb/zipball/1699864992c40ad02395e95d7fbf44a571a116f3", + "reference": "1699864992c40ad02395e95d7fbf44a571a116f3", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "4.8.*" + }, + "time": "2018-02-14T00:51:01+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "PicoDb": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frédéric Guillot", + "homepage": "https://github.com/fguillot/" + } + ], + "description": "Minimalist database query builder", + "homepage": "https://github.com/fguillot/picoDb" } ] 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(); } -- cgit v1.2.3