Skip to content

Commit 8a2dad3

Browse files
committed
Properly fetch oracle database information
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent b707dc3 commit 8a2dad3

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

lib/DatabaseStatistics.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
namespace OCA\ServerInfo;
2424

25+
use Doctrine\DBAL\DBALException;
2526
use OCP\IConfig;
2627
use OCP\IDBConnection;
2728

@@ -60,20 +61,22 @@ protected function databaseVersion() {
6061
$sql = 'SELECT sqlite_version() AS version';
6162
break;
6263
case 'oci':
63-
$sql = 'SELECT version FROM v$instance';
64+
$sql = 'SELECT VERSION FROM PRODUCT_COMPONENT_VERSION';
6465
break;
6566
case 'mysql':
6667
case 'pgsql':
6768
default:
6869
$sql = 'SELECT VERSION() AS version';
6970
break;
7071
}
72+
try {
7173
$result = $this->connection->executeQuery($sql);
72-
$row = $result->fetch();
73-
$result->closeCursor();
74-
if ($row) {
75-
return $this->cleanVersion($row['version']);
76-
}
74+
$version = $result->fetchColumn();
75+
$result->closeCursor();
76+
if ($version) {
77+
return $this->cleanVersion($version);
78+
}
79+
} catch (DBALException $e) {}
7780
return 'N/A';
7881
}
7982

@@ -143,7 +146,7 @@ protected function databaseSize() {
143146
$sql = 'SELECT SUM(bytes) as dbsize
144147
FROM user_segments';
145148
$result = $this->connection->executeQuery($sql);
146-
$database_size = ($row = $result->fetch()) ? $row['dbsize'] : false;
149+
$database_size = ($row = $result->fetchColumn()) ? (int)$row : false;
147150
$result->closeCursor();
148151
break;
149152
}

0 commit comments

Comments
 (0)