aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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