/** * Database version number * * @return string */ public function version() { if (isset($this->data_cache['version'])) { return $this->data_cache['version']; } if (!$this->conn_id or ($pg_version = pg_version($this->conn_id)) === FALSE) { return FALSE; } /* If PHP was compiled with PostgreSQL lib versions earlier * than 7.4, pg_version() won't return the server version * and so we'll have to fall back to running a query in * order to get it. */ return isset($pg_version['server']) ? $this->data_cache['version'] = $pg_version['server'] : parent::version(); }
/** * Database version number * * @return string */ public function version() { if (isset($this->data_cache['version'])) { return $this->data_cache['version']; } // Not all subdrivers support the getAttribute() method try { return $this->data_cache['version'] = $this->conn_id->getAttribute(PDO::ATTR_SERVER_VERSION); } catch (PDOException $e) { return parent::version(); } }