Example #1
0
 /**
  * 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
  */
 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 (null === $this->_conn) {
         $this->connect();
     }
     // Automatic platform version detection.
     if ($this->_conn instanceof ServerInfoAwareConnection && !$this->_conn->requiresQueryForServerVersion()) {
         return $this->_conn->getServerVersion();
     }
     // Unable to detect platform version.
     return null;
 }