ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilDBPdoFieldDefinition Class Reference

Class ilDBPdoFieldDefinition. More...

+ Inheritance diagram for ilDBPdoFieldDefinition:
+ Collaboration diagram for ilDBPdoFieldDefinition:

Public Member Functions

 __construct (protected \ilDBInterface $db_instance)
 ilDBPdoFieldDefinition constructor. More...
 
 checkTableName (string $table_name)
 
 isReserved (string $table_name)
 
 getAllReserved ()
 
 getReservedMysql ()
 
 setReservedMysql (array $reserved_mysql)
 
 checkColumnName (string $column_name)
 
 checkIndexName (string $a_name)
 
 checkColumnDefinition (array $a_def)
 
 isAllowedAttribute (string $attribute, string $type)
 
 getAvailableTypes ()
 
 setAvailableTypes (array $available_types)
 
 getAllowedAttributes ()
 
 setAllowedAttributes (array $allowed_attributes)
 
 getMaxLength ()
 
 setMaxLength (array $max_length)
 
 getValidTypes ()
 
 getDeclaration (string $type, string $name, array $field)
 
 getTypeDeclaration (array $field)
 
 compareDefinition (array $current, array $previous)
 
 quote ($value, ?string $type=null, bool $quote=true, bool $escape_wildcards=false)
 
 writeLOBToFile ($lob, string $file)
 
 destroyLOB ($lob)
 
 matchPattern (array $pattern, $operator=null, $field=null)
 
 patternEscapeString ()
 
 mapNativeDatatype (array $field)
 
 mapPrepareDatatype (string $type)
 

Data Fields

array $lobs
 
const DEFAULT_DECIMAL_PLACES = 2
 
const DEFAULT_TEXT_LENGTH = 4000
 
const DEFINITION_COLUMN_NAME = "/^[a-z]+[_a-z0-9]*$/"
 
const DEFINITION_TABLE_NAME = "/^[a-z]+[_a-z0-9]*$/"
 
const INDEX_FORMAT = '%s_idx'
 
const SEQUENCE_COLUMNS_NAME = 'sequence'
 
const SEQUENCE_FORMAT = '%s_seq'
 
const T_BLOB = 'blob'
 
const T_CLOB = 'clob'
 
const T_DATE = 'date'
 
const T_DATETIME = 'datetime'
 
const T_FLOAT = 'float'
 
const T_INTEGER = 'integer'
 
const T_TEXT = 'text'
 
const T_TIME = 'time'
 
const T_TIMESTAMP = 'timestamp'
 
array $allowed_attributes_old
 
array $allowed_attributes
 

Protected Member Functions

 getQueryUtils ()
 
 getDBInstance ()
 
 getInternalDeclaration (string $name, array $field)
 
 getDeclarationOptions (array $field)
 
 getCharsetFieldDeclaration (string $charset)
 
 getCollationFieldDeclaration (string $collation)
 
 getIntegerDeclaration (string $name, array $field)
 
 getTextDeclaration (string $name, array $field)
 
 getCLOBDeclaration (string $name, array $field)
 
 getBLOBDeclaration (string $name, array $field)
 
 getBooleanDeclaration (string $name, array $field)
 
 getDateDeclaration (string $name, array $field)
 
 getTimestampDeclaration (string $name, array $field)
 
 getTimeDeclaration (string $name, array $field)
 
 getFloatDeclaration (string $name, array $field)
 
 getDecimalDeclaration (string $name, array $field)
 
 compareIntegerDefinition (array $current, array $previous)
 
 compareTextDefinition (array $current, array $previous)
 
 compareCLOBDefinition (array $current, array $previous)
 
 compareBLOBDefinition (array $current, array $previous)
 
 compareDateDefinition (array $current, array $previous)
 
 compareTimeDefinition (array $current, array $previous)
 
 compareTimestampDefinition (array $current, array $previous)
 
 compareBooleanDefinition (array $current, array $previous)
 
 compareFloatDefinition (array $current, array $previous)
 
 compareDecimalDefinition (array $current, array $previous)
 
 quoteInteger ($value, bool $quote, bool $escape_wildcards)
 
 quoteText (string $value, bool $quote, bool $escape_wildcards)
 
 readFile ($value)
 
 quoteLOB ($value, bool $quote, bool $escape_wildcards)
 
 quoteCLOB ($value, bool $quote, bool $escape_wildcards)
 
 quoteBLOB ($value, bool $quote, bool $escape_wildcards)
 
 quoteBoolean (bool $value, bool $quote, bool $escape_wildcards)
 
 quoteDate (string $value, bool $quote, bool $escape_wildcards)
 
 quoteTimestamp (int $value, bool $quote, bool $escape_wildcards)
 
 quoteTime (int $value, bool $quote, bool $escape_wildcards)
 
 quoteFloat (string $value, bool $quote, bool $escape_wildcards)
 
 quoteDecimal (string $value, bool $quote, bool $escape_wildcards)
 
 retrieveLOB (array &$lob)
 
 readLOB (array $lob, int $length)
 
 endOfLOB (array $lob)
 
 mapNativeDatatypeInternal (array $field)
 

Protected Attributes

array $max_length
 
array $available_types
 
array $reserved_mysql
 
array $reserved_postgres
 
ilMySQLQueryUtils $query_utils = null
 
array $valid_default_values
 

Static Protected Attributes

static ilDBPdoFieldDefinition $instance
 

Private Attributes

const MAX_TABLE_IDENTIFIER_LENGTH = 63
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDBPdoFieldDefinition::__construct ( protected \ilDBInterface  $db_instance)

ilDBPdoFieldDefinition constructor.

Definition at line 829 of file class.ilDBPdoFieldDefinition.php.

830 {
831 }

Member Function Documentation

◆ checkColumnDefinition()

ilDBPdoFieldDefinition::checkColumnDefinition ( array  $a_def)
Exceptions

ilDatabaseException

Definition at line 958 of file class.ilDBPdoFieldDefinition.php.

958 : bool
959 {
960 // check valid type
961 if (!in_array($a_def["type"], $this->getAvailableTypes(), true)) {
962 switch ($a_def["type"]) {
963 case "boolean":
964 throw new ilDatabaseException("Invalid column type '" . $a_def["type"] . "'. Use integer(1) instead.");
965
966 case "decimal":
967 throw new ilDatabaseException("Invalid column type '" . $a_def["type"] . "'. Use float or integer instead.");
968
969 default:
970 throw new ilDatabaseException("Invalid column type '" . $a_def["type"] . "'. Allowed types are: "
971 . implode(', ', $this->getAvailableTypes()));
972 }
973 }
974
975 // check used attributes
977 foreach (array_keys($a_def) as $k) {
978 if ($k !== "type" && !in_array($k, $allowed_attributes[$a_def["type"]], true)) {
979 throw new ilDatabaseException("Attribute '" . $k . "' is not allowed for column type '" . $a_def["type"] . "'.");
980 }
981 }
982
983 // type specific checks
984 $max_length = $this->getMaxLength();
985 switch ($a_def["type"]) {
986 case self::T_TEXT:
987 if ((!isset($a_def["length"]) || $a_def["length"] < 1 || $a_def["length"] > $max_length[self::T_TEXT]) && isset($a_def["length"])) {
988 throw new ilDatabaseException("Invalid length '" . $a_def["length"] . "' for type text." . " Length must be >=1 and <= "
989 . $max_length[self::T_TEXT] . ".");
990 }
991 break;
992
993 case self::T_INTEGER:
994 if (isset($a_def["length"]) && !in_array((int) $a_def["length"], $max_length[self::T_INTEGER], true)) {
995 throw new ilDatabaseException("Invalid length '" . $a_def["length"] . "' for type integer." . " Length must be "
996 . implode(', ', $max_length[self::T_INTEGER]) . " (bytes).");
997 }
998 if ($a_def["unsigned"] ?? null) {
999 throw new ilDatabaseException("Unsigned attribut must not be true for type integer.");
1000 }
1001 break;
1002 }
1003
1004 return true;
1005 }
Class ilDatabaseException.

References $allowed_attributes, $max_length, getAllowedAttributes(), getAvailableTypes(), getMaxLength(), T_INTEGER, and T_TEXT.

+ Here is the call graph for this function:

◆ checkColumnName()

ilDBPdoFieldDefinition::checkColumnName ( string  $column_name)
Exceptions

ilDatabaseException

Definition at line 913 of file class.ilDBPdoFieldDefinition.php.

913 : bool
914 {
915 if (!preg_match("/^[a-z]+[_a-z0-9]*$/", $column_name)) {
916 throw new ilDatabaseException("Invalid column name '" . $column_name
917 . "'. Column name must only contain _a-z0-9 and must start with a-z.");
918 }
919
920 if ($this->isReserved($column_name)) {
921 throw new ilDatabaseException("Invalid column name '" . $column_name . "' (Reserved Word).");
922 }
923
924 if (stripos($column_name, "sys_") === 0) {
925 throw new ilDatabaseException("Invalid column name '" . $column_name . "'. Name must not start with 'sys_'.");
926 }
927
928 if (strlen($column_name) > 30) {
929 throw new ilDatabaseException("Invalid column name '" . $column_name . "'. Maximum column identifer length is 30 bytes.");
930 }
931
932 return true;
933 }

References isReserved().

+ Here is the call graph for this function:

◆ checkIndexName()

ilDBPdoFieldDefinition::checkIndexName ( string  $a_name)
Exceptions

ilDatabaseException

Definition at line 938 of file class.ilDBPdoFieldDefinition.php.

938 : bool
939 {
940 if (!preg_match("/^[a-z]+[_a-z0-9]*$/", $a_name)) {
941 throw new ilDatabaseException("Invalid column name '" . $a_name . "'. Column name must only contain _a-z0-9 and must start with a-z.");
942 }
943
944 if ($this->isReserved($a_name)) {
945 throw new ilDatabaseException("Invalid column name '" . $a_name . "' (Reserved Word).");
946 }
947
948 if (strlen($a_name) > 3) {
949 throw new ilDatabaseException("Invalid index name '" . $a_name . "'. Maximum index identifer length is 3 bytes.");
950 }
951
952 return true;
953 }

References isReserved().

+ Here is the call graph for this function:

◆ checkTableName()

ilDBPdoFieldDefinition::checkTableName ( string  $table_name)
Exceptions

ilDatabaseException

Definition at line 858 of file class.ilDBPdoFieldDefinition.php.

858 : bool
859 {
860 if (!preg_match(self::DEFINITION_TABLE_NAME, $table_name)) {
861 throw new ilDatabaseException('Table name must only contain _a-z0-9 and must start with a-z.');
862 }
863
864 if ($this->isReserved($table_name)) {
865 throw new ilDatabaseException("Invalid table name '" . $table_name . "' (Reserved Word).");
866 }
867
868 if (stripos($table_name, "sys_") === 0) {
869 throw new ilDatabaseException("Invalid table name '" . $table_name . "'. Name must not start with 'sys_'.");
870 }
871
872 if (strlen($table_name) > self::MAX_TABLE_IDENTIFIER_LENGTH) {
873 throw new ilDatabaseException("Invalid table name '" . $table_name
874 . "'. Maximum table identifer length is " . self::MAX_TABLE_IDENTIFIER_LENGTH . " bytes.");
875 }
876
877 return true;
878 }

References isReserved().

+ Here is the call graph for this function:

◆ compareBLOBDefinition()

ilDBPdoFieldDefinition::compareBLOBDefinition ( array  $current,
array  $previous 
)
protected
Returns
array<string, bool>

Definition at line 1384 of file class.ilDBPdoFieldDefinition.php.

1384 : array
1385 {
1386 return $this->compareTextDefinition($current, $previous);
1387 }
compareTextDefinition(array $current, array $previous)

References compareTextDefinition().

+ Here is the call graph for this function:

◆ compareBooleanDefinition()

ilDBPdoFieldDefinition::compareBooleanDefinition ( array  $current,
array  $previous 
)
protected

Definition at line 1404 of file class.ilDBPdoFieldDefinition.php.

1404 : array
1405 {
1406 return [];
1407 }

◆ compareCLOBDefinition()

ilDBPdoFieldDefinition::compareCLOBDefinition ( array  $current,
array  $previous 
)
protected
Returns
array<string, bool>

Definition at line 1376 of file class.ilDBPdoFieldDefinition.php.

1376 : array
1377 {
1378 return $this->compareTextDefinition($current, $previous);
1379 }

References compareTextDefinition().

+ Here is the call graph for this function:

◆ compareDateDefinition()

ilDBPdoFieldDefinition::compareDateDefinition ( array  $current,
array  $previous 
)
protected

Definition at line 1389 of file class.ilDBPdoFieldDefinition.php.

1389 : array
1390 {
1391 return [];
1392 }

◆ compareDecimalDefinition()

ilDBPdoFieldDefinition::compareDecimalDefinition ( array  $current,
array  $previous 
)
protected

Definition at line 1414 of file class.ilDBPdoFieldDefinition.php.

1414 : array
1415 {
1416 return [];
1417 }

◆ compareDefinition()

ilDBPdoFieldDefinition::compareDefinition ( array  $current,
array  $previous 
)
Exceptions

ilDatabaseException

Returns
array<string, bool>

Definition at line 1284 of file class.ilDBPdoFieldDefinition.php.

1284 : array
1285 {
1286 $type = empty($current['type']) ? null : $current['type'];
1287
1288 if (!method_exists($this, "compare{$type}Definition")) {
1289 $db = $this->getDBInstance();
1290
1291 if (!empty($db->options['datatype_map_callback'][$type])) {
1292 $parameter = ['current' => $current, 'previous' => $previous];
1293
1294 return call_user_func_array(
1295 $db->options['datatype_map_callback'][$type],
1296 [&$db, __FUNCTION__, $parameter]
1297 );
1298 }
1299
1300 throw new ilDatabaseException('type "' . $current['type'] . '" is not yet supported');
1301 }
1302
1303 if (empty($previous['type']) || $previous['type'] != $type) {
1304 return $current;
1305 }
1306
1307 $change = $this->{"compare{$type}Definition"}($current, $previous);
1308
1309 if ($previous['type'] != $type) {
1310 $change['type'] = true;
1311 }
1312
1313 $previous_notnull = empty($previous['notnull']) ? false : $previous['notnull'];
1314 $notnull = empty($current['notnull']) ? false : $current['notnull'];
1315 if ($previous_notnull !== $notnull) {
1316 $change['notnull'] = true;
1317 }
1318
1319 $alt = $previous_notnull ? '' : null;
1320 $previous_default = array_key_exists(
1321 'default',
1322 $previous
1323 ) ? $previous['default'] : $alt;
1324 $alt = $notnull ? '' : null;
1325 $default = array_key_exists('default', $current) ? $current['default'] : $alt;
1326 if ($previous_default !== $default) {
1327 $change['default'] = true;
1328 }
1329
1330 return $change;
1331 }

References getDBInstance().

+ Here is the call graph for this function:

◆ compareFloatDefinition()

ilDBPdoFieldDefinition::compareFloatDefinition ( array  $current,
array  $previous 
)
protected

Definition at line 1409 of file class.ilDBPdoFieldDefinition.php.

1409 : array
1410 {
1411 return [];
1412 }

◆ compareIntegerDefinition()

ilDBPdoFieldDefinition::compareIntegerDefinition ( array  $current,
array  $previous 
)
protected
Returns
array<string, bool>

Definition at line 1336 of file class.ilDBPdoFieldDefinition.php.

1336 : array
1337 {
1338 $change = [];
1339 $previous_unsigned = empty($previous['unsigned']) ? false : $previous['unsigned'];
1340 $unsigned = empty($current['unsigned']) ? false : $current['unsigned'];
1341 if ($previous_unsigned != $unsigned) {
1342 $change['unsigned'] = true;
1343 }
1344 $previous_autoincrement = empty($previous['autoincrement']) ? false : $previous['autoincrement'];
1345 $autoincrement = empty($current['autoincrement']) ? false : $current['autoincrement'];
1346 if ($previous_autoincrement != $autoincrement) {
1347 $change['autoincrement'] = true;
1348 }
1349
1350 return $change;
1351 }

◆ compareTextDefinition()

ilDBPdoFieldDefinition::compareTextDefinition ( array  $current,
array  $previous 
)
protected
Returns
array<string, bool>

Definition at line 1356 of file class.ilDBPdoFieldDefinition.php.

1356 : array
1357 {
1358 $change = [];
1359 $previous_length = empty($previous['length']) ? 0 : $previous['length'];
1360 $length = empty($current['length']) ? 0 : $current['length'];
1361 if ($previous_length != $length) {
1362 $change['length'] = true;
1363 }
1364 $previous_fixed = empty($previous['fixed']) ? 0 : $previous['fixed'];
1365 $fixed = empty($current['fixed']) ? 0 : $current['fixed'];
1366 if ($previous_fixed != $fixed) {
1367 $change['fixed'] = true;
1368 }
1369
1370 return $change;
1371 }

Referenced by compareBLOBDefinition(), and compareCLOBDefinition().

+ Here is the caller graph for this function:

◆ compareTimeDefinition()

ilDBPdoFieldDefinition::compareTimeDefinition ( array  $current,
array  $previous 
)
protected

Definition at line 1394 of file class.ilDBPdoFieldDefinition.php.

1394 : array
1395 {
1396 return [];
1397 }

◆ compareTimestampDefinition()

ilDBPdoFieldDefinition::compareTimestampDefinition ( array  $current,
array  $previous 
)
protected

Definition at line 1399 of file class.ilDBPdoFieldDefinition.php.

1399 : array
1400 {
1401 return [];
1402 }

◆ destroyLOB()

ilDBPdoFieldDefinition::destroyLOB (   $lob)
Parameters
resource$lob

Definition at line 1621 of file class.ilDBPdoFieldDefinition.php.

1621 : bool
1622 {
1623 $lob_data = stream_get_meta_data($lob);
1624 $lob_index = $lob_data['wrapper_data']->lob_index;
1625 fclose($lob);
1626 if (isset($this->lobs[$lob_index])) {
1627 unset($this->lobs[$lob_index]);
1628 }
1629
1630 return true;
1631 }

◆ endOfLOB()

ilDBPdoFieldDefinition::endOfLOB ( array  $lob)
protected
Returns
mixed

Definition at line 1613 of file class.ilDBPdoFieldDefinition.php.

1614 {
1615 return $lob['endOfLOB'];
1616 }

◆ getAllowedAttributes()

ilDBPdoFieldDefinition::getAllowedAttributes ( )
Returns
string[]

Definition at line 1031 of file class.ilDBPdoFieldDefinition.php.

1031 : array
1032 {
1034 }

References $allowed_attributes.

Referenced by checkColumnDefinition().

+ Here is the caller graph for this function:

◆ getAllReserved()

ilDBPdoFieldDefinition::getAllReserved ( )
Returns
string[]

Definition at line 888 of file class.ilDBPdoFieldDefinition.php.

888 : array
889 {
890 return $this->getReservedMysql();
891 }

References getReservedMysql().

+ Here is the call graph for this function:

◆ getAvailableTypes()

ilDBPdoFieldDefinition::getAvailableTypes ( )
Returns
string[]

Definition at line 1015 of file class.ilDBPdoFieldDefinition.php.

1015 : array
1016 {
1018 }

References $available_types.

Referenced by checkColumnDefinition().

+ Here is the caller graph for this function:

◆ getBLOBDeclaration()

ilDBPdoFieldDefinition::getBLOBDeclaration ( string  $name,
array  $field 
)
protected

Definition at line 1239 of file class.ilDBPdoFieldDefinition.php.

1239 : string
1240 {
1241 $db = $this->getDBInstance();
1242
1243 $notnull = empty($field['notnull']) ? '' : ' NOT NULL';
1244 $name = $db->quoteIdentifier($name, true);
1245
1246 return $name . ' ' . $this->getTypeDeclaration($field) . $notnull;
1247 }

References getDBInstance(), and getTypeDeclaration().

+ Here is the call graph for this function:

◆ getBooleanDeclaration()

ilDBPdoFieldDefinition::getBooleanDeclaration ( string  $name,
array  $field 
)
protected

Definition at line 1249 of file class.ilDBPdoFieldDefinition.php.

1249 : string
1250 {
1251 return $this->getInternalDeclaration($name, $field);
1252 }
getInternalDeclaration(string $name, array $field)

References getInternalDeclaration().

+ Here is the call graph for this function:

◆ getCharsetFieldDeclaration()

ilDBPdoFieldDefinition::getCharsetFieldDeclaration ( string  $charset)
protected

Definition at line 1203 of file class.ilDBPdoFieldDefinition.php.

1203 : string
1204 {
1205 return '';
1206 }

Referenced by getDeclarationOptions().

+ Here is the caller graph for this function:

◆ getCLOBDeclaration()

ilDBPdoFieldDefinition::getCLOBDeclaration ( string  $name,
array  $field 
)
protected

Definition at line 1229 of file class.ilDBPdoFieldDefinition.php.

1229 : string
1230 {
1231 $db = $this->getDBInstance();
1232
1233 $notnull = empty($field['notnull']) ? '' : ' NOT NULL';
1234 $name = $db->quoteIdentifier($name, true);
1235
1236 return $name . ' ' . $this->getTypeDeclaration($field) . $notnull;
1237 }

References getDBInstance(), and getTypeDeclaration().

+ Here is the call graph for this function:

◆ getCollationFieldDeclaration()

ilDBPdoFieldDefinition::getCollationFieldDeclaration ( string  $collation)
protected

Definition at line 1208 of file class.ilDBPdoFieldDefinition.php.

1208 : string
1209 {
1210 return '';
1211 }

Referenced by getDeclarationOptions().

+ Here is the caller graph for this function:

◆ getDateDeclaration()

ilDBPdoFieldDefinition::getDateDeclaration ( string  $name,
array  $field 
)
protected

Definition at line 1254 of file class.ilDBPdoFieldDefinition.php.

1254 : string
1255 {
1256 return $this->getInternalDeclaration($name, $field);
1257 }

References getInternalDeclaration().

+ Here is the call graph for this function:

◆ getDBInstance()

◆ getDecimalDeclaration()

ilDBPdoFieldDefinition::getDecimalDeclaration ( string  $name,
array  $field 
)
protected

Definition at line 1274 of file class.ilDBPdoFieldDefinition.php.

1274 : string
1275 {
1276 return $this->getInternalDeclaration($name, $field);
1277 }

References getInternalDeclaration().

+ Here is the call graph for this function:

◆ getDeclaration()

ilDBPdoFieldDefinition::getDeclaration ( string  $type,
string  $name,
array  $field 
)
Returns
mixed
Exceptions

ilDatabaseException

Definition at line 1091 of file class.ilDBPdoFieldDefinition.php.

1092 {
1093 $db = $this->getDBInstance();
1094
1095 if (!empty($db->options['datatype_map'][$type])) {
1096 $type = $db->options['datatype_map'][$type];
1097 if (!empty($db->options['datatype_map_callback'][$type])) {
1098 $parameter = ['type' => $type, 'name' => $name, 'field' => $field];
1099
1100 return call_user_func_array(
1101 $db->options['datatype_map_callback'][$type],
1102 [&$db, __FUNCTION__, $parameter]
1103 );
1104 }
1105 $field['type'] = $type;
1106 }
1107
1108 if (!method_exists($this, "get{$type}Declaration")) {
1109 throw new ilDatabaseException('type not defined: ' . $type);
1110 }
1111
1112 return $this->{"get{$type}Declaration"}($name, $field);
1113 }

References getDBInstance().

+ Here is the call graph for this function:

◆ getDeclarationOptions()

ilDBPdoFieldDefinition::getDeclarationOptions ( array  $field)
protected
Exceptions

ilDatabaseException

Definition at line 1164 of file class.ilDBPdoFieldDefinition.php.

1164 : string
1165 {
1166 $charset = empty($field['charset']) ? '' : ' ' . $this->getCharsetFieldDeclaration($field['charset']);
1167
1168 $default = '';
1169 if (array_key_exists('default', $field)) {
1170 if ($field['default'] === '') {
1171 $db = $this->getDBInstance();
1172
1173 if (empty($field['notnull'])) {
1174 $field['default'] = null;
1175 } else {
1177 $field['default'] = $valid_default_values[$field['type']];
1178 }
1179 if ($field['default'] === ''
1180 && isset($db->options["portability"])
1181 && ($db->options['portability'] & 32)
1182 ) {
1183 $field['default'] = ' ';
1184 }
1185 }
1186 $default = ' DEFAULT ' . $this->quote($field['default'], $field['type']);
1187 } elseif (empty($field['notnull'])) {
1188 $default = ' DEFAULT NULL';
1189 }
1190
1191 $notnull = empty($field['notnull']) ? '' : ' NOT NULL';
1192 // alex patch 28 Nov 2011 start
1193 if (isset($field["notnull"]) && $field['notnull'] === false) {
1194 $notnull = " NULL";
1195 }
1196 // alex patch 28 Nov 2011 end
1197
1198 $collation = empty($field['collation']) ? '' : ' ' . $this->getCollationFieldDeclaration($field['collation']);
1199
1200 return $charset . $default . $notnull . $collation;
1201 }
getCollationFieldDeclaration(string $collation)
quote($value, ?string $type=null, bool $quote=true, bool $escape_wildcards=false)

References $valid_default_values, getCharsetFieldDeclaration(), getCollationFieldDeclaration(), getDBInstance(), getValidTypes(), and quote().

+ Here is the call graph for this function:

◆ getFloatDeclaration()

ilDBPdoFieldDefinition::getFloatDeclaration ( string  $name,
array  $field 
)
protected

Definition at line 1269 of file class.ilDBPdoFieldDefinition.php.

1269 : string
1270 {
1271 return $this->getInternalDeclaration($name, $field);
1272 }

References getInternalDeclaration().

+ Here is the call graph for this function:

◆ getIntegerDeclaration()

ilDBPdoFieldDefinition::getIntegerDeclaration ( string  $name,
array  $field 
)
protected
Exceptions

ilDatabaseException

Reimplemented in ilDBPdoMySQLFieldDefinition.

Definition at line 1216 of file class.ilDBPdoFieldDefinition.php.

1216 : string
1217 {
1218 return $this->getInternalDeclaration($name, $field);
1219 }

References getInternalDeclaration().

+ Here is the call graph for this function:

◆ getInternalDeclaration()

ilDBPdoFieldDefinition::getInternalDeclaration ( string  $name,
array  $field 
)
protected

Definition at line 1147 of file class.ilDBPdoFieldDefinition.php.

1147 : string
1148 {
1149 $db = $this->getDBInstance();
1150
1151 $name = $db->quoteIdentifier($name, true);
1152 $declaration_options = '';
1153 $fd = $db->getFieldDefinition();
1154 if ($fd !== null) {
1155 $declaration_options = $fd->getDeclarationOptions($field);
1156 }
1157
1158 return $name . ' ' . $this->getTypeDeclaration($field) . $declaration_options;
1159 }

References getDBInstance(), and getTypeDeclaration().

Referenced by getBooleanDeclaration(), getDateDeclaration(), getDecimalDeclaration(), getFloatDeclaration(), getIntegerDeclaration(), getTextDeclaration(), getTimeDeclaration(), and getTimestampDeclaration().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMaxLength()

ilDBPdoFieldDefinition::getMaxLength ( )

Definition at line 1044 of file class.ilDBPdoFieldDefinition.php.

1044 : array
1045 {
1046 return $this->max_length;
1047 }

References $max_length.

Referenced by checkColumnDefinition().

+ Here is the caller graph for this function:

◆ getQueryUtils()

ilDBPdoFieldDefinition::getQueryUtils ( )
protected

Definition at line 833 of file class.ilDBPdoFieldDefinition.php.

834 {
835 if ($this->query_utils === null) {
836 $this->query_utils = new ilMySQLQueryUtils($this->db_instance);
837 }
838
839 return $this->query_utils;
840 }
Class ilMySQLQueryUtils.

References $query_utils.

◆ getReservedMysql()

ilDBPdoFieldDefinition::getReservedMysql ( )
Returns
string[]

Definition at line 896 of file class.ilDBPdoFieldDefinition.php.

896 : array
897 {
899 }

References $reserved_mysql.

Referenced by getAllReserved().

+ Here is the caller graph for this function:

◆ getTextDeclaration()

ilDBPdoFieldDefinition::getTextDeclaration ( string  $name,
array  $field 
)
protected
Exceptions

ilDatabaseException

Definition at line 1224 of file class.ilDBPdoFieldDefinition.php.

1224 : string
1225 {
1226 return $this->getInternalDeclaration($name, $field);
1227 }

References getInternalDeclaration().

+ Here is the call graph for this function:

◆ getTimeDeclaration()

ilDBPdoFieldDefinition::getTimeDeclaration ( string  $name,
array  $field 
)
protected

Definition at line 1264 of file class.ilDBPdoFieldDefinition.php.

1264 : string
1265 {
1266 return $this->getInternalDeclaration($name, $field);
1267 }

References getInternalDeclaration().

+ Here is the call graph for this function:

◆ getTimestampDeclaration()

ilDBPdoFieldDefinition::getTimestampDeclaration ( string  $name,
array  $field 
)
protected

Definition at line 1259 of file class.ilDBPdoFieldDefinition.php.

1259 : string
1260 {
1261 return $this->getInternalDeclaration($name, $field);
1262 }

References getInternalDeclaration().

+ Here is the call graph for this function:

◆ getTypeDeclaration()

ilDBPdoFieldDefinition::getTypeDeclaration ( array  $field)

Reimplemented in ilDBPdoMySQLFieldDefinition.

Definition at line 1115 of file class.ilDBPdoFieldDefinition.php.

1115 : string
1116 {
1117 $db = $this->getDBInstance();
1118
1119 switch ($field['type']) {
1120 case 'text':
1121 $length = empty($field['length']) ? $db->options['default_text_field_length'] : $field['length'];
1122 $fixed = empty($field['fixed']) ? false : $field['fixed'];
1123 if ($fixed) {
1124 return $length ? 'CHAR(' . $length . ')' : 'CHAR(' . $db->options['default_text_field_length'] . ')';
1125 }
1126
1127 return $length ? 'VARCHAR(' . $length . ')' : 'TEXT';
1128 case 'clob':
1129 case 'decimal':
1130 case 'float':
1131 case 'blob':
1132 return 'TEXT';
1133 case 'integer':
1134 case 'boolean':
1135 return 'INT';
1136 case 'date':
1137 return 'CHAR (' . strlen('YYYY-MM-DD') . ')';
1138 case 'time':
1139 return 'CHAR (' . strlen('HH:MM:SS') . ')';
1140 case 'timestamp':
1141 return 'CHAR (' . strlen('YYYY-MM-DD HH:MM:SS') . ')';
1142 }
1143
1144 return '';
1145 }

References getDBInstance().

Referenced by getBLOBDeclaration(), getCLOBDeclaration(), and getInternalDeclaration().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValidTypes()

ilDBPdoFieldDefinition::getValidTypes ( )
Returns
string[]

Definition at line 1062 of file class.ilDBPdoFieldDefinition.php.

1062 : array
1063 {
1065 $db = $this->getDBInstance();
1066
1067 if (!empty($db->options['datatype_map'])) {
1068 foreach ($db->options['datatype_map'] as $type => $mapped_type) {
1069 if (array_key_exists($mapped_type, $types)) {
1070 $types[$type] = $types[$mapped_type];
1071 } elseif (!empty($db->options['datatype_map_callback'][$type])) {
1072 $parameter = ['type' => $type, 'mapped_type' => $mapped_type];
1073 $default = call_user_func_array(
1074 $db->options['datatype_map_callback'][$type],
1075 [&$db, __FUNCTION__, $parameter]
1076 );
1077 $types[$type] = $default;
1078 }
1079 }
1080 }
1081
1082 return $types;
1083 }

References $valid_default_values, and getDBInstance().

Referenced by getDeclarationOptions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAllowedAttribute()

ilDBPdoFieldDefinition::isAllowedAttribute ( string  $attribute,
string  $type 
)

Definition at line 1007 of file class.ilDBPdoFieldDefinition.php.

1007 : bool
1008 {
1009 return in_array($attribute, $this->allowed_attributes[$type], true);
1010 }

◆ isReserved()

ilDBPdoFieldDefinition::isReserved ( string  $table_name)

Definition at line 880 of file class.ilDBPdoFieldDefinition.php.

880 : bool
881 {
882 return false;
883 }

Referenced by checkColumnName(), checkIndexName(), and checkTableName().

+ Here is the caller graph for this function:

◆ mapNativeDatatype()

ilDBPdoFieldDefinition::mapNativeDatatype ( array  $field)
Returns
mixed

Definition at line 1687 of file class.ilDBPdoFieldDefinition.php.

1688 {
1689 $db = $this->getDBInstance();
1690 $db_type = strtok($field['type'], '(), ');
1691 if (!empty($db->options['nativetype_map_callback'][$db_type])) {
1692 return call_user_func_array($db->options['nativetype_map_callback'][$db_type], [$db, $field]);
1693 }
1694
1695 return $this->mapNativeDatatypeInternal($field);
1696 }
mapNativeDatatypeInternal(array $field)

References getDBInstance(), and mapNativeDatatypeInternal().

+ Here is the call graph for this function:

◆ mapNativeDatatypeInternal()

ilDBPdoFieldDefinition::mapNativeDatatypeInternal ( array  $field)
abstractprotected
Exceptions

ilDatabaseException

Reimplemented in ilDBPdoMySQLFieldDefinition.

Referenced by mapNativeDatatype().

+ Here is the caller graph for this function:

◆ mapPrepareDatatype()

ilDBPdoFieldDefinition::mapPrepareDatatype ( string  $type)
Returns
mixed

Definition at line 1706 of file class.ilDBPdoFieldDefinition.php.

1707 {
1708 $db = $this->getDBInstance();
1709
1710 if (!empty($db->options['datatype_map'][$type])) {
1711 $type = $db->options['datatype_map'][$type];
1712 if (!empty($db->options['datatype_map_callback'][$type])) {
1713 $parameter = ['type' => $type];
1714
1715 return call_user_func_array(
1716 $db->options['datatype_map_callback'][$type],
1717 [&$db, __FUNCTION__, $parameter]
1718 );
1719 }
1720 }
1721
1722 return $type;
1723 }

References getDBInstance().

+ Here is the call graph for this function:

◆ matchPattern()

ilDBPdoFieldDefinition::matchPattern ( array  $pattern,
  $operator = null,
  $field = null 
)
Exceptions

ilDatabaseException

Definition at line 1637 of file class.ilDBPdoFieldDefinition.php.

1637 : string
1638 {
1639 $db = $this->getDBInstance();
1640
1641 $match = '';
1642 if (!is_null($operator)) {
1643 $operator = strtoupper((string) $operator);
1644 switch ($operator) {
1645 // case insensitive
1646 case 'ILIKE':
1647 if (is_null($field)) {
1648 throw new ilDatabaseException('case insensitive LIKE matching requires passing the field name');
1649 }
1650 $db->loadModule('Function');
1651 $match = $db->lower($field) . ' LIKE ';
1652 break;
1653 // case sensitive
1654 case 'LIKE':
1655 $match = is_null($field) ? 'LIKE ' : $field . ' LIKE ';
1656 break;
1657 default:
1658 throw new ilDatabaseException('not a supported operator type:' . $operator);
1659 }
1660 }
1661 $match .= "'";
1662 foreach ($pattern as $key => $value) {
1663 if ($key % 2 !== 0) {
1664 $match .= $value;
1665 } else {
1666 if ($operator === 'ILIKE') {
1667 $value = strtolower((string) $value);
1668 }
1669 $escaped = $db->escape($value);
1670 $match .= $db->escapePattern($escaped);
1671 }
1672 }
1673 $match .= "'";
1674 $match .= $this->patternEscapeString();
1675
1676 return $match;
1677 }

References getDBInstance(), and patternEscapeString().

+ Here is the call graph for this function:

◆ patternEscapeString()

ilDBPdoFieldDefinition::patternEscapeString ( )

Definition at line 1679 of file class.ilDBPdoFieldDefinition.php.

1679 : string
1680 {
1681 return '';
1682 }

Referenced by matchPattern().

+ Here is the caller graph for this function:

◆ quote()

ilDBPdoFieldDefinition::quote (   $value,
?string  $type = null,
bool  $quote = true,
bool  $escape_wildcards = false 
)
Parameters
mixed$value

Definition at line 1422 of file class.ilDBPdoFieldDefinition.php.

1422 : string
1423 {
1424 return $this->getDBInstance()->quote($value, $type ?? '');
1425 }

References getDBInstance().

Referenced by getDeclarationOptions(), and ilDBPdoMySQLFieldDefinition\getIntegerDeclaration().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quoteBLOB()

ilDBPdoFieldDefinition::quoteBLOB (   $value,
bool  $quote,
bool  $escape_wildcards 
)
protected
Parameters
string | resource$value

Definition at line 1498 of file class.ilDBPdoFieldDefinition.php.

1498 : string
1499 {
1500 return $this->quoteLOB($value, $quote, $escape_wildcards);
1501 }
quoteLOB($value, bool $quote, bool $escape_wildcards)

References quoteLOB().

+ Here is the call graph for this function:

◆ quoteBoolean()

ilDBPdoFieldDefinition::quoteBoolean ( bool  $value,
bool  $quote,
bool  $escape_wildcards 
)
protected

Definition at line 1503 of file class.ilDBPdoFieldDefinition.php.

1503 : int
1504 {
1505 return ($value ? 1 : 0);
1506 }

◆ quoteCLOB()

ilDBPdoFieldDefinition::quoteCLOB (   $value,
bool  $quote,
bool  $escape_wildcards 
)
protected
Parameters
string | resource$value

Definition at line 1491 of file class.ilDBPdoFieldDefinition.php.

1491 : string
1492 {
1493 return $this->quoteLOB($value, $quote, $escape_wildcards);
1494 }

References quoteLOB().

+ Here is the call graph for this function:

◆ quoteDate()

ilDBPdoFieldDefinition::quoteDate ( string  $value,
bool  $quote,
bool  $escape_wildcards 
)
protected

Definition at line 1508 of file class.ilDBPdoFieldDefinition.php.

1508 : string
1509 {
1510 if ($value === 'CURRENT_DATE') {
1511 return 'CURRENT_DATE';
1512 }
1513
1514 return $this->quoteText($value, $quote, $escape_wildcards);
1515 }
quoteText(string $value, bool $quote, bool $escape_wildcards)

References quoteText().

+ Here is the call graph for this function:

◆ quoteDecimal()

ilDBPdoFieldDefinition::quoteDecimal ( string  $value,
bool  $quote,
bool  $escape_wildcards 
)
protected

Definition at line 1545 of file class.ilDBPdoFieldDefinition.php.

1545 : ?string
1546 {
1547 $value = preg_replace('/[^\d\.,\-+eE]/', '', $value);
1548 if (preg_match('/[^.0-9]/', (string) $value) && strpos((string) $value, ',')) {
1549 // 1000,00
1550 if (!strpos((string) $value, '.')) {
1551 // convert the last "," to a "."
1552 $value = strrev(str_replace(',', '.', strrev((string) $value)));
1553 // 1.000,00
1554 } elseif (strpos((string) $value, '.') && strpos((string) $value, '.') < strpos((string) $value, ',')) {
1555 $value = str_replace('.', '', $value);
1556 // convert the last "," to a "."
1557 $value = strrev(str_replace(',', '.', strrev($value)));
1558 // 1,000.00
1559 } else {
1560 $value = str_replace(',', '', $value);
1561 }
1562 }
1563
1564 return $value;
1565 }

Referenced by quoteFloat().

+ Here is the caller graph for this function:

◆ quoteFloat()

ilDBPdoFieldDefinition::quoteFloat ( string  $value,
bool  $quote,
bool  $escape_wildcards 
)
protected

Definition at line 1533 of file class.ilDBPdoFieldDefinition.php.

1533 : ?string
1534 {
1535 if (preg_match('/^(.*)e([-+])(\d+)$/i', $value, $matches)) {
1536 $decimal = $this->quoteDecimal($matches[1], $quote, $escape_wildcards);
1537 $sign = $matches[2];
1538 $exponent = str_pad($matches[3], 2, '0', STR_PAD_LEFT);
1539 return $decimal . 'E' . $sign . $exponent;
1540 }
1541
1542 return $this->quoteDecimal($value, $quote, $escape_wildcards);
1543 }
quoteDecimal(string $value, bool $quote, bool $escape_wildcards)

References quoteDecimal().

+ Here is the call graph for this function:

◆ quoteInteger()

ilDBPdoFieldDefinition::quoteInteger (   $value,
bool  $quote,
bool  $escape_wildcards 
)
protected
Parameters
mixed$value

Definition at line 1430 of file class.ilDBPdoFieldDefinition.php.

1430 : int
1431 {
1432 return (int) $value;
1433 }

◆ quoteLOB()

ilDBPdoFieldDefinition::quoteLOB (   $value,
bool  $quote,
bool  $escape_wildcards 
)
protected
Parameters
string | resource$value

Definition at line 1482 of file class.ilDBPdoFieldDefinition.php.

1482 : string
1483 {
1484 $value = $this->readFile($value);
1485
1486 return $this->quoteText($value, $quote, $escape_wildcards);
1487 }

References quoteText(), and readFile().

Referenced by quoteBLOB(), and quoteCLOB().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quoteText()

ilDBPdoFieldDefinition::quoteText ( string  $value,
bool  $quote,
bool  $escape_wildcards 
)
protected

Definition at line 1435 of file class.ilDBPdoFieldDefinition.php.

1435 : string
1436 {
1437 if (!$quote) {
1438 return $value;
1439 }
1440
1441 $db = $this->getDBInstance();
1442
1443 $value = $db->escape($value, $escape_wildcards);
1444
1445 return "'" . $value . "'";
1446 }

References getDBInstance().

Referenced by quoteDate(), and quoteLOB().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quoteTime()

ilDBPdoFieldDefinition::quoteTime ( int  $value,
bool  $quote,
bool  $escape_wildcards 
)
protected
Deprecated:

Definition at line 1528 of file class.ilDBPdoFieldDefinition.php.

1528 : string
1529 {
1530 throw new ilDatabaseException("deprecated");
1531 }

◆ quoteTimestamp()

ilDBPdoFieldDefinition::quoteTimestamp ( int  $value,
bool  $quote,
bool  $escape_wildcards 
)
protected
Deprecated:

Definition at line 1520 of file class.ilDBPdoFieldDefinition.php.

1520 : string
1521 {
1522 throw new ilDatabaseException("deprecated");
1523 }

◆ readFile()

ilDBPdoFieldDefinition::readFile (   $value)
protected
Parameters
string | resource$value

Definition at line 1451 of file class.ilDBPdoFieldDefinition.php.

1451 : string
1452 {
1453 $close = false;
1454 if (is_string($value) && preg_match('/^(\w+:\/\/)(.*)$/', $value, $match)) {
1455 $close = true;
1456 if ($match[1] === 'file://') {
1457 $value = $match[2];
1458 }
1459 // do not try to open urls
1460 #$value = @fopen($value, 'r');
1461 }
1462
1463 if (is_resource($value)) {
1464 $db = $this->getDBInstance();
1465
1466 $fp = $value;
1467 $value = '';
1468 while (!@feof($fp)) {
1469 $value .= @fread($fp, $db->options['lob_buffer_length']);
1470 }
1471 if ($close) {
1472 @fclose($fp);
1473 }
1474 }
1475
1476 return $value;
1477 }

References getDBInstance().

Referenced by quoteLOB().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readLOB()

ilDBPdoFieldDefinition::readLOB ( array  $lob,
int  $length 
)
protected

Definition at line 1605 of file class.ilDBPdoFieldDefinition.php.

1605 : string
1606 {
1607 return substr((string) $lob['value'], $lob['position'], $length);
1608 }

◆ retrieveLOB()

ilDBPdoFieldDefinition::retrieveLOB ( array &  $lob)
protected

Definition at line 1595 of file class.ilDBPdoFieldDefinition.php.

1595 : bool
1596 {
1597 if (is_null($lob['value'])) {
1598 $lob['value'] = $lob['resource'];
1599 }
1600 $lob['loaded'] = true;
1601
1602 return true;
1603 }

◆ setAllowedAttributes()

ilDBPdoFieldDefinition::setAllowedAttributes ( array  $allowed_attributes)
Parameters
string[]$allowed_attributes

Definition at line 1039 of file class.ilDBPdoFieldDefinition.php.

1039 : void
1040 {
1041 $this->allowed_attributes = $allowed_attributes;
1042 }

References $allowed_attributes.

◆ setAvailableTypes()

ilDBPdoFieldDefinition::setAvailableTypes ( array  $available_types)
Parameters
string[]$available_types

Definition at line 1023 of file class.ilDBPdoFieldDefinition.php.

1023 : void
1024 {
1025 $this->available_types = $available_types;
1026 }

References $available_types.

◆ setMaxLength()

ilDBPdoFieldDefinition::setMaxLength ( array  $max_length)

Definition at line 1049 of file class.ilDBPdoFieldDefinition.php.

1049 : void
1050 {
1051 $this->max_length = $max_length;
1052 }

References $max_length.

◆ setReservedMysql()

ilDBPdoFieldDefinition::setReservedMysql ( array  $reserved_mysql)
Parameters
string[]$reserved_mysql

Definition at line 904 of file class.ilDBPdoFieldDefinition.php.

904 : void
905 {
906 $this->reserved_mysql = $reserved_mysql;
907 }

References $reserved_mysql.

◆ writeLOBToFile()

ilDBPdoFieldDefinition::writeLOBToFile (   $lob,
string  $file 
)
Parameters
resource$lob
Exceptions

ilDatabaseException

Definition at line 1572 of file class.ilDBPdoFieldDefinition.php.

1572 : bool
1573 {
1574 $db = $this->getDBInstance();
1575
1576 if (preg_match('/^(\w+:\/\/)(.*)$/', $file, $match) && $match[1] === 'file://') {
1577 $file = $match[2];
1578 }
1579
1580 $fp = @fopen($file, 'wb');
1581 while (!@feof($lob)) {
1582 $result = @fread($lob, $db->options['lob_buffer_length']);
1583 $read = strlen($result);
1584 if (@fwrite($fp, $result, $read) !== $read) {
1585 @fclose($fp);
1586
1587 throw new ilDatabaseException('could not write to the output file');
1588 }
1589 }
1590 @fclose($fp);
1591
1592 return true;
1593 }

References getDBInstance().

+ Here is the call graph for this function:

Field Documentation

◆ $allowed_attributes

array ilDBPdoFieldDefinition::$allowed_attributes
Initial value:
= [
"text" => ["length", "notnull", "default", "fixed"],
"integer" => ["length", "notnull", "default", "unsigned"],
"float" => ["notnull", "default"],
"date" => ["notnull", "default"],
"time" => ["notnull", "default"],
"timestamp" => ["notnull", "default"],
"clob" => ["length", "notnull", "default"],
"blob" => ["length", "notnull", "default"],
]

Definition at line 64 of file class.ilDBPdoFieldDefinition.php.

Referenced by checkColumnDefinition(), getAllowedAttributes(), and setAllowedAttributes().

◆ $allowed_attributes_old

array ilDBPdoFieldDefinition::$allowed_attributes_old
Initial value:
= [
self::T_TEXT => ['length', 'notnull', 'default', 'fixed'],
self::T_INTEGER => ['length', 'notnull', 'default', 'unsigned'],
self::T_FLOAT => ['notnull', 'default'],
self::T_DATE => ['notnull', 'default'],
self::T_TIME => ['notnull', 'default'],
self::T_TIMESTAMP => ['notnull', 'default'],
self::T_CLOB => ['notnull', 'default'],
self::T_BLOB => ['notnull', 'default'],
]

Definition at line 51 of file class.ilDBPdoFieldDefinition.php.

◆ $available_types

◆ $instance

ilDBPdoFieldDefinition ilDBPdoFieldDefinition::$instance
staticprotected

Definition at line 47 of file class.ilDBPdoFieldDefinition.php.

◆ $lobs

array ilDBPdoFieldDefinition::$lobs

Definition at line 27 of file class.ilDBPdoFieldDefinition.php.

◆ $max_length

array ilDBPdoFieldDefinition::$max_length
protected
Initial value:
= [
self::T_INTEGER => [1, 2, 3, 4, 8],
self::T_TEXT => 4000,
]

Definition at line 74 of file class.ilDBPdoFieldDefinition.php.

Referenced by checkColumnDefinition(), getMaxLength(), and setMaxLength().

◆ $query_utils

ilMySQLQueryUtils ilDBPdoFieldDefinition::$query_utils = null
protected

Definition at line 824 of file class.ilDBPdoFieldDefinition.php.

Referenced by getQueryUtils().

◆ $reserved_mysql

array ilDBPdoFieldDefinition::$reserved_mysql
protected

Definition at line 94 of file class.ilDBPdoFieldDefinition.php.

Referenced by getReservedMysql(), and setReservedMysql().

◆ $reserved_postgres

array ilDBPdoFieldDefinition::$reserved_postgres
protected

Definition at line 724 of file class.ilDBPdoFieldDefinition.php.

◆ $valid_default_values

array ilDBPdoFieldDefinition::$valid_default_values
protected
Initial value:
= [
'text' => '',
'boolean' => true,
'integer' => 0,
'decimal' => 0.0,
'float' => 0.0,
'timestamp' => '1970-01-01 00:00:00',
'time' => '00:00:00',
'date' => '1970-01-01',
'clob' => '',
'blob' => '',
]

Definition at line 842 of file class.ilDBPdoFieldDefinition.php.

Referenced by getDeclarationOptions(), and getValidTypes().

◆ DEFAULT_DECIMAL_PLACES

const ilDBPdoFieldDefinition::DEFAULT_DECIMAL_PLACES = 2

Definition at line 28 of file class.ilDBPdoFieldDefinition.php.

◆ DEFAULT_TEXT_LENGTH

const ilDBPdoFieldDefinition::DEFAULT_TEXT_LENGTH = 4000

Definition at line 29 of file class.ilDBPdoFieldDefinition.php.

◆ DEFINITION_COLUMN_NAME

const ilDBPdoFieldDefinition::DEFINITION_COLUMN_NAME = "/^[a-z]+[_a-z0-9]*$/"

Definition at line 30 of file class.ilDBPdoFieldDefinition.php.

◆ DEFINITION_TABLE_NAME

const ilDBPdoFieldDefinition::DEFINITION_TABLE_NAME = "/^[a-z]+[_a-z0-9]*$/"

Definition at line 31 of file class.ilDBPdoFieldDefinition.php.

◆ INDEX_FORMAT

const ilDBPdoFieldDefinition::INDEX_FORMAT = '%s_idx'

◆ MAX_TABLE_IDENTIFIER_LENGTH

const ilDBPdoFieldDefinition::MAX_TABLE_IDENTIFIER_LENGTH = 63
private

Definition at line 45 of file class.ilDBPdoFieldDefinition.php.

◆ SEQUENCE_COLUMNS_NAME

const ilDBPdoFieldDefinition::SEQUENCE_COLUMNS_NAME = 'sequence'

Definition at line 33 of file class.ilDBPdoFieldDefinition.php.

◆ SEQUENCE_FORMAT

const ilDBPdoFieldDefinition::SEQUENCE_FORMAT = '%s_seq'

Definition at line 34 of file class.ilDBPdoFieldDefinition.php.

Referenced by ilDBPdo\getSequenceName().

◆ T_BLOB

const ilDBPdoFieldDefinition::T_BLOB = 'blob'

Definition at line 35 of file class.ilDBPdoFieldDefinition.php.

◆ T_CLOB

const ilDBPdoFieldDefinition::T_CLOB = 'clob'

Definition at line 36 of file class.ilDBPdoFieldDefinition.php.

◆ T_DATE

const ilDBPdoFieldDefinition::T_DATE = 'date'

Definition at line 37 of file class.ilDBPdoFieldDefinition.php.

◆ T_DATETIME

const ilDBPdoFieldDefinition::T_DATETIME = 'datetime'

Definition at line 38 of file class.ilDBPdoFieldDefinition.php.

◆ T_FLOAT

const ilDBPdoFieldDefinition::T_FLOAT = 'float'

Definition at line 39 of file class.ilDBPdoFieldDefinition.php.

◆ T_INTEGER

const ilDBPdoFieldDefinition::T_INTEGER = 'integer'

Definition at line 40 of file class.ilDBPdoFieldDefinition.php.

Referenced by checkColumnDefinition().

◆ T_TEXT

const ilDBPdoFieldDefinition::T_TEXT = 'text'

Definition at line 41 of file class.ilDBPdoFieldDefinition.php.

Referenced by checkColumnDefinition().

◆ T_TIME

const ilDBPdoFieldDefinition::T_TIME = 'time'

Definition at line 42 of file class.ilDBPdoFieldDefinition.php.

◆ T_TIMESTAMP

const ilDBPdoFieldDefinition::T_TIMESTAMP = 'timestamp'

Definition at line 43 of file class.ilDBPdoFieldDefinition.php.


The documentation for this class was generated from the following file: