lib/Doctrine/DBAL/Connection.php
private function getDatabasePlatformVersion()
    {
        // Driver does not support version specific platforms.
        if (! $this->_driver instanceof VersionAwarePlatformDriver) {
            return null;
        }

        // Explicit platform version requested (supersedes auto-detection).
        if (isset($this->params['serverVersion'])) {
            return $this->params['serverVersion'];
        }

        // If not connected, we need to connect now to determine the platform version.
        if ($this->_conn === null) {
            try {
                $this->connect();
            } catch (Throwable $originalException) {
                if (empty($this->params['dbname'])) {
                    throw $originalException;
                }

                // The database to connect to might not yet exist.
                // Retry detection without database name connection parameter.
                $databaseName           = $this->params['dbname'];
                $this->params['dbname'] = null;

                try {
                    $this->connect();
                } catch (Throwable $fallbackException) {
                    // Either the platform does not support database-less connections
                    // or something else went wrong.
                    // Reset connection parameters and rethrow the original exception.
                    $this->params['dbname'] = $databaseName;

                    throw $originalException;
                }

                // Reset connection parameters.
                $this->params['dbname'] = $databaseName;
                $serverVersion          = $this->getServerVersion();

                // Close "temporary" connection to allow connecting to the real database again.
                $this->close();

                return $serverVersion;
            }
        }

        return $this->getServerVersion();
    }
private function getDatabasePlatformVersion()
    {
        // Driver does not support version specific platforms.
        if (! $this->_driver instanceof VersionAwarePlatformDriver) {
            return null;
        }

        // Explicit platform version requested (supersedes auto-detection).
        if (isset($this->params['serverVersion'])) {
            return $this->params['serverVersion'];
        }

        // If not connected, we need to connect now to determine the platform version.
        if ($this->_conn === null) {
            try {
                $this->connect();
            } catch (Throwable $originalException) {
                if (empty($this->params['dbname'])) {
                    throw $originalException;
                }

                // The database to connect to might not yet exist.
                // Retry detection without database name connection parameter.
                $databaseName           = $this->params['dbname'];
                $this->params['dbname'] = null;

                try {
                    $this->connect();
                } catch (Throwable $fallbackException) {
                    // Either the platform does not support database-less connections
                    // or something else went wrong.
                    // Reset connection parameters and rethrow the original exception.
                    $this->params['dbname'] = $databaseName;

                    throw $originalException;
                }

                // Reset connection parameters.
                $this->params['dbname'] = $databaseName;
                $serverVersion          = $this->getServerVersion();

                // Close "temporary" connection to allow connecting to the real database again.
                $this->close();

                return $serverVersion;
            }
        }

        return $this->getServerVersion();
    }
private function getDatabasePlatformVersion ( ) { // Driver does not support version specific platforms. if ( ! $ this -> _driver instanceof VersionAwarePlatformDriver ) { return null ; } // Explicit platform version requested (supersedes auto-detection). if ( isset ( $ this -> params [ 'serverVersion' ] ) ) { return $ this -> params [ 'serverVersion' ] ; } // If not connected, we need to connect now to determine the platform version. if ( $ this -> _conn === null ) { try { $ this -> connect ( ) ; } catch ( Throwable $ originalException ) { if ( empty ( $ this -> params [ 'dbname' ] ) ) { throw $ originalException ; } // The database to connect to might not yet exist. // Retry detection without database name connection parameter. $ databaseName = $ this -> params [ 'dbname' ] ; $ this -> params [ 'dbname' ] = null ; try { $ this -> connect ( ) ; } catch ( Throwable $ fallbackException ) { // Either the platform does not support database-less connections // or something else went wrong. // Reset connection parameters and rethrow the original exception. $ this -> params [ 'dbname' ] = $ databaseName ; throw $ originalException ; } // Reset connection parameters. $ this -> params [ 'dbname' ] = $ databaseName ; $ serverVersion = $ this -> getServerVersion ( ) ; // Close "temporary" connection to allow connecting to the real database again. $ this -> close ( ) ; return $ serverVersion ; } } return $ this -> getServerVersion ( ) ; }
Returns the version of the related platform if applicable.

Returns null if either the driver is not capable to create version
specific platform instances, no explicit server version was specified
or the underlying driver connection cannot determine the platform
version without having to query it (performance reasons).

@return string|null

@throws Exception
Returns the version of the related platform if applicable .