ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
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
87 // Mapping AutoExec
88 public const AUTOQUERY_INSERT = 1;
89 public const AUTOQUERY_UPDATE = 2;
90 public const AUTOQUERY_DELETE = 3;
91 public const AUTOQUERY_SELECT = 4;
92 public const PREPARE_MANIP = false;
93 // Other
94 public const MB4_REPLACEMENT = "?";
98 protected static array $descriptions = [
99 // Main
100 ilDBConstants::TYPE_MYSQL => "MySQL 5.7.x or higher with InnoDB-Engine",
101 ilDBConstants::TYPE_MYSQLI => "MySQL 5.7.x or higher with InnoDB-Engine",
102 ilDBConstants::TYPE_INNODB => "MySQL 5.7.x or higher with InnoDB-Engine",
103 ilDBConstants::TYPE_GALERA => "Galera-Cluster (experimental)",
104 // Development identifiers (will be removed in 5.3)
105 ilDBConstants::TYPE_PDO_MYSQL_GALERA => "Galera-Cluster (experimental) [developers-identifier]",
106 ];
107
108
112 public static function getInstallableTypes(): array
113 {
114 return [
115 // Main
118 // Experimental
121 ];
122 }
123
124 public static function getAvailableTypes(bool $with_descriptions = true): array
125 {
126 $types = self::getSupportedTypes();
127 if ($with_descriptions) {
128 $return = [];
129 foreach ($types as $type) {
130 $return [$type] = self::describe($type);
131 }
132 $types = $return;
133 }
134
135 return $types;
136 }
137
138
139 public static function getSupportedTypes(): array
140 {
141 return [
145 ];
146 }
147
151 public static function getAvailableCollations(): array
152 {
153 return [
172 ];
173 }
174
175 public static function describe(string $type): string
176 {
177 return self::$descriptions[$type];
178 }
179}
Class ilDBConstants.
const MYSQL_COLLATION_UTF8_SLOVAK
const MYSQL_COLLATION_UTF8_TURKISH
const MODULE_MANAGER
const AUTOQUERY_DELETE
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_UTF8_DANISH
const AUTOQUERY_SELECT
const AUTOQUERY_UPDATE
const TYPE_PDO_MYSQL_GALERA
static describe(string $type)
const MYSQL_CHARACTER_UTF8MB4
const MYSQL_COLLATION_UTF8MB4
const MYSQL_COLLATION_UTF8_ROMANIAN
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 LOCK_WRITE
Definition: ilAtomQuery.php:30
const LOCK_READ
Definition: ilAtomQuery.php:31