/** * Creates the PDO instance. * * This method is called by {@see \rock\db\Connection::open()} to establish a DB connection. * The default implementation will create a PHP PDO instance. * You may override this method if the default PDO needs to be adapted for certain DBMS. * @return PDO the pdo instance */ protected function createPdoInstance() { $pdoClass = $this->pdoClass; if ($pdoClass === null) { $pdoClass = 'PDO'; if ($this->_driverName !== null) { $driver = $this->_driverName; } elseif (($pos = strpos($this->dsn, ':')) !== false) { $driver = strtolower(substr($this->dsn, 0, $pos)); } if (isset($driver) && ($driver === 'mssql' || $driver === 'dblib' || $driver === 'sqlsrv')) { $pdoClass = \rock\db\mssql\PDO::className(); } } return new $pdoClass($this->dsn, $this->username, $this->password, $this->attributes); }