aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVarun Patil <varunpatil@ucla.edu>2025-08-03 19:10:09 -0700
committerVarun Patil <varunpatil@ucla.edu>2025-08-03 19:10:20 -0700
commitbd704700343715aacea0828a318cca847eb10dd5 (patch)
treef292006a1cf3294db47cdbb09e8efdda4bb5ba71
parent894463b93595bb34e4176e8b700ceb13835c2af0 (diff)
downloadnextcloud-server-pulsejet/db-check-maria.tar.gz
nextcloud-server-pulsejet/db-check-maria.zip
feat(db): add method to test mariadbpulsejet/db-check-maria
There are some behavioral differences that apps may need to check for. See discussion on #51175 for more info. This preserves the existing behavior of getDatabaseProvider() Signed-off-by: Varun Patil <varunpatil@ucla.edu>
-rw-r--r--lib/private/DB/Connection.php5
-rw-r--r--lib/private/DB/ConnectionAdapter.php4
-rw-r--r--lib/public/IDBConnection.php8
3 files changed, 17 insertions, 0 deletions
diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php
index 88bdc377e2b..757f13b0b8e 100644
--- a/lib/private/DB/Connection.php
+++ b/lib/private/DB/Connection.php
@@ -16,6 +16,7 @@ use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Exception\ConnectionLost;
+use Doctrine\DBAL\Platforms\MariaDBPlatform;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
@@ -932,6 +933,10 @@ class Connection extends PrimaryReadReplicaConnection {
}
}
+ public function isDatabaseProviderMariaDB(): bool {
+ return $this->getDatabasePlatform() instanceof MariaDBPlatform;
+ }
+
/**
* @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.
diff --git a/lib/private/DB/ConnectionAdapter.php b/lib/private/DB/ConnectionAdapter.php
index 78ca780f218..9c6371db4ad 100644
--- a/lib/private/DB/ConnectionAdapter.php
+++ b/lib/private/DB/ConnectionAdapter.php
@@ -243,6 +243,10 @@ class ConnectionAdapter implements IDBConnection {
return $this->inner->getDatabaseProvider();
}
+ public function isDatabaseProviderMariaDB(): bool {
+ return $this->inner->isDatabaseProviderMariaDB();
+ }
+
/**
* @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.
diff --git a/lib/public/IDBConnection.php b/lib/public/IDBConnection.php
index e0fe603ec57..ab2cc8fdad0 100644
--- a/lib/public/IDBConnection.php
+++ b/lib/public/IDBConnection.php
@@ -364,6 +364,14 @@ interface IDBConnection {
public function getDatabaseProvider(): string;
/**
+ * Returns if the database provider is MariaDB.
+ * This can be used to differentiate the provider between MySQL and MariaDB.
+ * @since 32.0.0
+ * @return bool
+ */
+ public function isDatabaseProviderMariaDB(): bool;
+
+ /**
* Get the shard definition by name, if configured
*
* @param string $name