From 94f34a2a33de503fe74b693e87d70ded343f3887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radovan=20Kep=C3=A1k?= Date: Wed, 4 Mar 2015 11:16:07 +0100 Subject: [PATCH] DibiPdoDriver: added support for version specified in options If driver do not support ATTR_SERVER_VERSION (like dblib) fallback to the version from config, or set null as we do not know what is the driver version. I belive this is better solution then add some creazy switch with queries for all possible versions on all drivers, and becouse it is faster to pass variable then run query asking about version. --- dibi/drivers/DibiPdoDriver.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dibi/drivers/DibiPdoDriver.php b/dibi/drivers/DibiPdoDriver.php index 4bbde339..79718912 100644 --- a/dibi/drivers/DibiPdoDriver.php +++ b/dibi/drivers/DibiPdoDriver.php @@ -19,6 +19,7 @@ require_once dirname(__FILE__) . '/DibiSqliteReflector.php'; * - password (or pass) * - options (array) => driver specific options {@see PDO::__construct} * - resource (PDO) => existing connection + * - version * - lazy, profiler, result, substitutes, ... => see DibiConnection options * * @author David Grudl @@ -78,7 +79,9 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver, IDibiResultDriver } $this->driverName = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME); - $this->serverVersion = $this->connection->getAttribute(PDO::ATTR_SERVER_VERSION); + $this->serverVersion = isset($config['version']) + ? $config['version'] + : @$this->connection->getAttribute(PDO::ATTR_SERVER_VERSION); // @ - may be not supported }