summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2021-01-12 10:14:49 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2021-01-12 14:09:13 +0100
commitd4e6463eb27c44d2aad5befe1c687934ded5164e (patch)
treed1a12ef72a2a7d05dc0ff7b7cbc297db2964ed52
parent90c0e943dd15239def4b5d35ad7e417afe49e65b (diff)
downloadnextcloud-server-d4e6463eb27c44d2aad5befe1c687934ded5164e.tar.gz
nextcloud-server-d4e6463eb27c44d2aad5befe1c687934ded5164e.zip
Add our own constants for db column types
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
-rw-r--r--lib/composer/composer/autoload_classmap.php1
-rw-r--r--lib/composer/composer/autoload_static.php1
-rw-r--r--lib/public/DB/Types.php113
3 files changed, 115 insertions, 0 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index a69437f1d47..dc5f9dc9e8e 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -171,6 +171,7 @@ return array(
'OCP\\DB\\QueryBuilder\\IParameter' => $baseDir . '/lib/public/DB/QueryBuilder/IParameter.php',
'OCP\\DB\\QueryBuilder\\IQueryBuilder' => $baseDir . '/lib/public/DB/QueryBuilder/IQueryBuilder.php',
'OCP\\DB\\QueryBuilder\\IQueryFunction' => $baseDir . '/lib/public/DB/QueryBuilder/IQueryFunction.php',
+ 'OCP\\DB\\Types' => $baseDir . '/lib/public/DB/Types.php',
'OCP\\Dashboard\\Exceptions\\DashboardAppNotAvailableException' => $baseDir . '/lib/public/Dashboard/Exceptions/DashboardAppNotAvailableException.php',
'OCP\\Dashboard\\IDashboardManager' => $baseDir . '/lib/public/Dashboard/IDashboardManager.php',
'OCP\\Dashboard\\IDashboardWidget' => $baseDir . '/lib/public/Dashboard/IDashboardWidget.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 4c46c7bc43e..455fb01b18e 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -200,6 +200,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\DB\\QueryBuilder\\IParameter' => __DIR__ . '/../../..' . '/lib/public/DB/QueryBuilder/IParameter.php',
'OCP\\DB\\QueryBuilder\\IQueryBuilder' => __DIR__ . '/../../..' . '/lib/public/DB/QueryBuilder/IQueryBuilder.php',
'OCP\\DB\\QueryBuilder\\IQueryFunction' => __DIR__ . '/../../..' . '/lib/public/DB/QueryBuilder/IQueryFunction.php',
+ 'OCP\\DB\\Types' => __DIR__ . '/../../..' . '/lib/public/DB/Types.php',
'OCP\\Dashboard\\Exceptions\\DashboardAppNotAvailableException' => __DIR__ . '/../../..' . '/lib/public/Dashboard/Exceptions/DashboardAppNotAvailableException.php',
'OCP\\Dashboard\\IDashboardManager' => __DIR__ . '/../../..' . '/lib/public/Dashboard/IDashboardManager.php',
'OCP\\Dashboard\\IDashboardWidget' => __DIR__ . '/../../..' . '/lib/public/Dashboard/IDashboardWidget.php',
diff --git a/lib/public/DB/Types.php b/lib/public/DB/Types.php
new file mode 100644
index 00000000000..2fb1c13a529
--- /dev/null
+++ b/lib/public/DB/Types.php
@@ -0,0 +1,113 @@
+<?php
+
+declare(strict_types=1);
+
+/*
+ * @copyright 2021 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2021 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace OCP\DB;
+
+/**
+ * Database types supported by Nextcloud's DBs
+ *
+ * Use these constants instead of \Doctrine\DBAL\Types\Type or \Doctrine\DBAL\Types\Types
+ *
+ * @since 21.0.0
+ */
+final class Types {
+ /**
+ * @var string
+ * @since 21.0.0
+ */
+ public const BIGINT = 'bigint';
+
+ /**
+ * @var string
+ * @since 21.0.0
+ */
+ public const BINARY = 'binary';
+
+ /**
+ * @var string
+ * @since 21.0.0
+ */
+ public const BLOB = 'blob';
+
+ /**
+ * @var string
+ * @since 21.0.0
+ */
+ public const BOOLEAN = 'boolean';
+
+ /**
+ * @var string
+ * @since 21.0.0
+ */
+ public const DATE = 'date';
+
+ /**
+ * @var string
+ * @since 21.0.0
+ */
+ public const DATETIME = 'datetime';
+
+ /**
+ * @var string
+ * @since 21.0.0
+ */
+ public const DECIMAL = 'decimal';
+
+ /**
+ * @var string
+ * @since 21.0.0
+ */
+ public const FLOAT = 'float';
+
+ /**
+ * @var string
+ * @since 21.0.0
+ */
+ public const INTEGER = 'integer';
+
+ /**
+ * @var string
+ * @since 21.0.0
+ */
+ public const SMALLINT = 'smallint';
+
+ /**
+ * @var string
+ * @since 21.0.0
+ */
+ public const STRING = 'string';
+
+ /**
+ * @var string
+ * @since 21.0.0
+ */
+ public const TEXT = 'text';
+
+ /**
+ * @var string
+ * @since 21.0.0
+ */
+ public const TIME = 'time';
+}