diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2025-01-12 23:13:37 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2025-01-29 12:42:44 +0100 |
commit | 71e4326606c416cff077009f49a63d134c458557 (patch) | |
tree | fa7c7dd82c187e8139ea541a70a961df6e264e14 | |
parent | 7eb6f9b11d015ee9646478f0f6bc7d717eb1979c (diff) | |
download | volse-hubzilla-71e4326606c416cff077009f49a63d134c458557.tar.gz volse-hubzilla-71e4326606c416cff077009f49a63d134c458557.tar.bz2 volse-hubzilla-71e4326606c416cff077009f49a63d134c458557.zip |
Fetch the server version on dba_pdo::connect.
The server version string is useful to among other things check whether
we are running on a real MySQL system, or MariaDB. Instead of fetching
it every time we need it, cache it in the dba_pdo object when we connect
to the db.
-rw-r--r-- | include/dba/dba_pdo.php | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/dba/dba_pdo.php b/include/dba/dba_pdo.php index 503b71233..b8b673727 100644 --- a/include/dba/dba_pdo.php +++ b/include/dba/dba_pdo.php @@ -10,6 +10,8 @@ class dba_pdo extends dba_driver { public $driver_dbtype = null; + private string $server_version = ''; + /** * {@inheritDoc} * @see dba_driver::connect() @@ -37,6 +39,7 @@ class dba_pdo extends dba_driver { try { $this->db = new PDO($dsn,$user,$pass); $this->db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); + $this->server_version = $this->db->getAttribute(PDO::ATTR_SERVER_VERSION); } catch(PDOException $e) { if(file_exists('dbfail.out')) { |