1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-06 14:16:39 +02:00

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.
This commit is contained in:
Radovan Kepák
2015-03-04 11:16:07 +01:00
committed by David Grudl
parent a3e5ac86f7
commit 94f34a2a33

View File

@@ -19,6 +19,7 @@ require_once dirname(__FILE__) . '/DibiSqliteReflector.php';
* - password (or pass) * - password (or pass)
* - options (array) => driver specific options {@see PDO::__construct} * - options (array) => driver specific options {@see PDO::__construct}
* - resource (PDO) => existing connection * - resource (PDO) => existing connection
* - version
* - lazy, profiler, result, substitutes, ... => see DibiConnection options * - lazy, profiler, result, substitutes, ... => see DibiConnection options
* *
* @author David Grudl * @author David Grudl
@@ -78,7 +79,9 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver, IDibiResultDriver
} }
$this->driverName = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME); $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
} }