diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index f59c6b34836de..744b81033d733 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -749,4 +749,12 @@ public function getDatabaseProvider(): string { throw new \Exception('Database ' . $platform::class . ' not supported'); } } + + /** + * @internal Should only be used inside the QueryBuilder, ExpressionBuilder and FunctionBuilder + * All apps and API code should not need this and instead use provided functionality from the above. + */ + public function getServerVersion(): string { + return $this->_conn->getServerVersion(); + } } diff --git a/lib/private/DB/ConnectionAdapter.php b/lib/private/DB/ConnectionAdapter.php index 8a919696eaa2f..b7225169e4c28 100644 --- a/lib/private/DB/ConnectionAdapter.php +++ b/lib/private/DB/ConnectionAdapter.php @@ -232,4 +232,12 @@ public function getInner(): Connection { public function getDatabaseProvider(): string { return $this->inner->getDatabaseProvider(); } + + /** + * @internal Should only be used inside the QueryBuilder, ExpressionBuilder and FunctionBuilder + * All apps and API code should not need this and instead use provided functionality from the above. + */ + public function getServerVersion(): string { + return $this->inner->getServerVersion(); + } } diff --git a/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php b/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php index d0258eafea879..2b934b6256408 100644 --- a/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php +++ b/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php @@ -12,6 +12,9 @@ class OCIFunctionBuilder extends FunctionBuilder { public function md5($input): IQueryFunction { + if (version_compare($this->connection->getServerVersion(), '20', '>=')) { + return new QueryFunction('LOWER(STANDARD_HASH(' . $this->helper->quoteColumnName($input) . ', "MD5"))'); + } return new QueryFunction('LOWER(DBMS_OBFUSCATION_TOOLKIT.md5 (input => UTL_RAW.cast_to_raw(' . $this->helper->quoteColumnName($input) .')))'); }