ILIAS  trunk Revision v13.0_alpha-46-gad4e41c4eac
ilDBConstants.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
29{
30 public const FETCHMODE_ASSOC = 2;
31 public const FETCHMODE_OBJECT = 3;
33 // Main Types
34 public const TYPE_INNODB = 'innodb';
35 public const TYPE_MYSQL = 'mysql';
36 // Experimental
37 public const TYPE_GALERA = 'galera';
38 public const TYPE_MYSQLI = 'mysqli';
39 // Development identifiers (will be removed in 5.3), are mapped with Main and Experimental types
40 public const TYPE_PDO_MYSQL_INNODB = 'pdo-mysql-innodb';
41 public const TYPE_PDO_MYSQL_GALERA = 'pdo-mysql-galera';
42 // Locks
45 // Modules
46 public const MODULE_MANAGER = 'Manager';
47 public const MODULE_REVERSE = 'Reverse';
48 // Formats
49 public const INDEX_FORMAT = FieldDefinition::INDEX_FORMAT;
50 public const SEQUENCE_FORMAT = FieldDefinition::SEQUENCE_FORMAT;
51 public const SEQUENCE_COLUMNS_NAME = FieldDefinition::SEQUENCE_COLUMNS_NAME;
52 // Types
53 public const T_CLOB = FieldDefinition::T_CLOB;
54 public const T_DATE = FieldDefinition::T_DATE;
55 public const T_DATETIME = FieldDefinition::T_DATETIME;
56 public const T_FLOAT = FieldDefinition::T_FLOAT;
57 public const T_INTEGER = FieldDefinition::T_INTEGER;
58 public const T_TEXT = FieldDefinition::T_TEXT;
59 public const T_TIME = FieldDefinition::T_TIME;
60 public const T_TIMESTAMP = FieldDefinition::T_TIMESTAMP;
61 public const T_BLOB = FieldDefinition::T_BLOB;
62 // Engines
63 public const MYSQL_ENGINE_INNODB = 'InnoDB';
64 // Characters
65 public const MYSQL_CHARACTER_UTF8 = 'utf8';
66 public const MYSQL_CHARACTER_UTF8MB4 = 'utf8mb4';
67 // Collations
68 public const MYSQL_COLLATION_UTF8 = 'utf8_general_ci';
69 public const MYSQL_COLLATION_UTF8MB4 = 'utf8mb4_general_ci';
70 public const MYSQL_COLLATION_UTF8_CZECH = "utf8_czech_ci";
71 public const MYSQL_COLLATION_UTF8_DANISH = "utf8_danish_ci";
72 public const MYSQL_COLLATION_UTF8_ESTONIAN = "utf8_estonian_ci";
73 public const MYSQL_COLLATION_UTF8_ICELANDIC = "utf8_icelandic_ci";
74 public const MYSQL_COLLATION_UTF8_LATVIAN = "utf8_latvian_ci";
75 public const MYSQL_COLLATION_UTF8_LITHUANIAN = "utf8_lithuanian_ci";
76 public const MYSQL_COLLATION_UTF8_PERSIAN = "utf8_persian_ci";
77 public const MYSQL_COLLATION_UTF8_POLISH = "utf8_polish_ci";
78 public const MYSQL_COLLATION_UTF8_ROMAN = "utf8_roman_ci";
79 public const MYSQL_COLLATION_UTF8_ROMANIAN = "utf8_romanian_ci";
80 public const MYSQL_COLLATION_UTF8_SLOVAK = "utf8_slovak_ci";
81 public const MYSQL_COLLATION_UTF8_SLOVENIAN = "utf8_slovenian_ci";
82 public const MYSQL_COLLATION_UTF8_SPANISH2 = "utf8_spanish2_ci";
83 public const MYSQL_COLLATION_UTF8_SPANISH = "utf8_spanish_ci";
84 public const MYSQL_COLLATION_UTF8_SWEDISH = "utf8_swedish_ci";
85 public const MYSQL_COLLATION_UTF8_TURKISH = "utf8_turkish_ci";
86 public const MYSQL_COLLATION_UTF8MB4_UNICODE = 'utf8mb4_unicode_ci';
87 public const MYSQL_COLLATION_UTF8MB4_520 = 'utf8mb4_unicode_520_ci';
88 public const MYSQL_COLLATION_UTF8MB4_0900 = 'utf8mb4_0900_ai_ci';
89 public const MARIADB_COLLATION_UCA = 'uca1400_ai_ci';
90
91 // Mapping AutoExec
92 public const AUTOQUERY_INSERT = 1;
93 public const AUTOQUERY_UPDATE = 2;
94 public const AUTOQUERY_DELETE = 3;
95 public const AUTOQUERY_SELECT = 4;
96 public const PREPARE_MANIP = false;
97 // Other
98 public const MB4_REPLACEMENT = "?";
102 protected static array $descriptions = [
103 // Main
104 ilDBConstants::TYPE_MYSQL => "MySQL 5.7.x or higher with InnoDB-Engine",
105 ilDBConstants::TYPE_MYSQLI => "MySQL 5.7.x or higher with InnoDB-Engine",
106 ilDBConstants::TYPE_INNODB => "MySQL 5.7.x or higher with InnoDB-Engine",
107 ilDBConstants::TYPE_GALERA => "Galera-Cluster (experimental)",
108 // Development identifiers (will be removed in 5.3)
109 ilDBConstants::TYPE_PDO_MYSQL_GALERA => "Galera-Cluster (experimental) [developers-identifier]",
110 ];
111
112
116 public static function getInstallableTypes(): array
117 {
118 return [
119 // Main
122 // Experimental
125 ];
126 }
127
128 public static function getAvailableTypes(bool $with_descriptions = true): array
129 {
130 $types = self::getSupportedTypes();
131 if ($with_descriptions) {
132 $return = [];
133 foreach ($types as $type) {
134 $return [$type] = self::describe($type);
135 }
136 $types = $return;
137 }
138
139 return $types;
140 }
141
142
143 public static function getSupportedTypes(): array
144 {
145 return [
149 ];
150 }
151
155 public static function getAvailableCollations(): array
156 {
157 return [
180 ];
181 }
182
183 public static function isUTF8MB4Collation(string $collation): bool
184 {
185 return in_array($collation, [
191 ], true);
192 }
193
194 public static function describe(string $type): string
195 {
196 return self::$descriptions[$type];
197 }
198}
Class ilDBConstants.
const MYSQL_COLLATION_UTF8_SLOVAK
const MYSQL_COLLATION_UTF8_TURKISH
const MODULE_MANAGER
const AUTOQUERY_DELETE
static isUTF8MB4Collation(string $collation)
const MYSQL_COLLATION_UTF8_SPANISH2
const MYSQL_COLLATION_UTF8
static getAvailableCollations()
const FETCHMODE_DEFAULT
const MYSQL_CHARACTER_UTF8
const MYSQL_COLLATION_UTF8_LATVIAN
static getSupportedTypes()
const FETCHMODE_OBJECT
const SEQUENCE_COLUMNS_NAME
static array $descriptions
const MODULE_REVERSE
const MYSQL_COLLATION_UTF8_ICELANDIC
const MYSQL_COLLATION_UTF8_CZECH
const SEQUENCE_FORMAT
const AUTOQUERY_INSERT
const MYSQL_COLLATION_UTF8_SLOVENIAN
const FETCHMODE_ASSOC
const MYSQL_COLLATION_UTF8_ROMAN
const MYSQL_COLLATION_UTF8_PERSIAN
const MYSQL_ENGINE_INNODB
const MYSQL_COLLATION_UTF8MB4_UNICODE
const MYSQL_COLLATION_UTF8_DANISH
const AUTOQUERY_SELECT
const AUTOQUERY_UPDATE
const TYPE_PDO_MYSQL_GALERA
static describe(string $type)
const MYSQL_CHARACTER_UTF8MB4
const MARIADB_COLLATION_UCA
const MYSQL_COLLATION_UTF8MB4
const MYSQL_COLLATION_UTF8_ROMANIAN
const MYSQL_COLLATION_UTF8MB4_520
const MYSQL_COLLATION_UTF8_LITHUANIAN
const MB4_REPLACEMENT
const MYSQL_COLLATION_UTF8_POLISH
const TYPE_PDO_MYSQL_INNODB
static getAvailableTypes(bool $with_descriptions=true)
const MYSQL_COLLATION_UTF8_ESTONIAN
const MYSQL_COLLATION_UTF8_SWEDISH
static getInstallableTypes()
const MYSQL_COLLATION_UTF8_SPANISH
const MYSQL_COLLATION_UTF8MB4_0900
const LOCK_WRITE
Definition: ilAtomQuery.php:30
const LOCK_READ
Definition: ilAtomQuery.php:31