Skip to content

Commit

Permalink
fix(db): Fix md5 for oracle >= 20
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Jul 19, 2024
1 parent 817ca00 commit 2ecf40f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/private/DB/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Check failure on line 758 in lib/private/DB/Connection.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

UndefinedInterfaceMethod

lib/private/DB/Connection.php:758:24: UndefinedInterfaceMethod: Method Doctrine\DBAL\Driver\Connection::getServerVersion does not exist (see https://psalm.dev/181)

Check failure

Code scanning / Psalm

UndefinedInterfaceMethod Error

Method Doctrine\DBAL\Driver\Connection::getServerVersion does not exist
}
}
8 changes: 8 additions & 0 deletions lib/private/DB/ConnectionAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

class OCIFunctionBuilder extends FunctionBuilder {
public function md5($input): IQueryFunction {
if (version_compare($this->connection->getServerVersion(), '20', '>=')) {

Check failure on line 15 in lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

UndefinedInterfaceMethod

lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php:15:42: UndefinedInterfaceMethod: Method OCP\IDBConnection::getServerVersion does not exist (see https://psalm.dev/181)

Check failure

Code scanning / Psalm

UndefinedInterfaceMethod Error

Method OCP\IDBConnection::getServerVersion does not exist
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) .')))');
}

Expand Down

0 comments on commit 2ecf40f

Please sign in to comment.