diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-11-19 17:12:06 +0300 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2020-12-02 19:58:21 +0300 |
commit | e08f9d4e5f31ac255d5eb715e9cc7c870dc2c50a (patch) | |
tree | 23f28ed79680cb5c79adc08c4c63860ae00b7d0e | |
parent | cc4a32c686c1ebeac1010c1adda5809af552ea35 (diff) |
Properly fetch oracle database information
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r-- | lib/DatabaseStatistics.php | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/DatabaseStatistics.php b/lib/DatabaseStatistics.php index b7694b4..afdd039 100644 --- a/lib/DatabaseStatistics.php +++ b/lib/DatabaseStatistics.php @@ -22,6 +22,7 @@ namespace OCA\ServerInfo; +use Doctrine\DBAL\DBALException; use OCP\IConfig; use OCP\IDBConnection; @@ -60,7 +61,7 @@ class DatabaseStatistics { $sql = 'SELECT sqlite_version() AS version'; break; case 'oci': - $sql = 'SELECT version FROM v$instance'; + $sql = 'SELECT VERSION FROM PRODUCT_COMPONENT_VERSION'; break; case 'mysql': case 'pgsql': @@ -68,11 +69,14 @@ class DatabaseStatistics { $sql = 'SELECT VERSION() AS version'; break; } - $result = $this->connection->executeQuery($sql); - $row = $result->fetch(); - $result->closeCursor(); - if ($row) { - return $this->cleanVersion($row['version']); + try { + $result = $this->connection->executeQuery($sql); + $version = $result->fetchColumn(); + $result->closeCursor(); + if ($version) { + return $this->cleanVersion($version); + } + } catch (DBALException $e) { } return 'N/A'; } @@ -143,7 +147,7 @@ class DatabaseStatistics { $sql = 'SELECT SUM(bytes) as dbsize FROM user_segments'; $result = $this->connection->executeQuery($sql); - $database_size = ($row = $result->fetch()) ? $row['dbsize'] : false; + $database_size = ($row = $result->fetchColumn()) ? (int)$row : false; $result->closeCursor(); break; } |