ILIAS  release_8 Revision v8.24
ilDBPdoFieldDefinition Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct (\ilDBInterface $ilDBInterface)
 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, $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

ilDBInterface $db_instance
 
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
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilDBPdoFieldDefinition

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

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

Constructor & Destructor Documentation

◆ __construct()

ilDBPdoFieldDefinition::__construct ( \ilDBInterface  $ilDBInterface)

ilDBPdoFieldDefinition constructor.

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

828 {
829 $this->db_instance = $ilDBInterface;
830 }

Member Function Documentation

◆ checkColumnDefinition()

ilDBPdoFieldDefinition::checkColumnDefinition ( array  $a_def)
Exceptions

ilDatabaseException

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

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

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 911 of file class.ilDBPdoFieldDefinition.php.

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

References isReserved().

+ Here is the call graph for this function:

◆ checkIndexName()

ilDBPdoFieldDefinition::checkIndexName ( string  $a_name)
Exceptions

ilDatabaseException

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

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

References isReserved().

+ Here is the call graph for this function:

◆ checkTableName()

ilDBPdoFieldDefinition::checkTableName ( string  $table_name)
Exceptions

ilDatabaseException

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

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

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 1382 of file class.ilDBPdoFieldDefinition.php.

1382 : array
1383 {
1384 return $this->compareTextDefinition($current, $previous);
1385 }
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 1402 of file class.ilDBPdoFieldDefinition.php.

1402 : array
1403 {
1404 return array();
1405 }

◆ compareCLOBDefinition()

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

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

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

References compareTextDefinition().

+ Here is the call graph for this function:

◆ compareDateDefinition()

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

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

1387 : array
1388 {
1389 return array();
1390 }

◆ compareDecimalDefinition()

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

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

1412 : array
1413 {
1414 return array();
1415 }

◆ compareDefinition()

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

ilDatabaseException

Returns
array<string, bool>

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

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

References $type, and getDBInstance().

+ Here is the call graph for this function:

◆ compareFloatDefinition()

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

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

1407 : array
1408 {
1409 return array();
1410 }

◆ compareIntegerDefinition()

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

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

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

◆ compareTextDefinition()

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

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

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

Referenced by compareBLOBDefinition(), and compareCLOBDefinition().

+ Here is the caller graph for this function:

◆ compareTimeDefinition()

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

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

1392 : array
1393 {
1394 return array();
1395 }

◆ compareTimestampDefinition()

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

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

1397 : array
1398 {
1399 return array();
1400 }

◆ 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 1029 of file class.ilDBPdoFieldDefinition.php.

1029 : array
1030 {
1032 }

References $allowed_attributes.

Referenced by checkColumnDefinition().

+ Here is the caller graph for this function:

◆ getAllReserved()

ilDBPdoFieldDefinition::getAllReserved ( )
Returns
string[]

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

886 : array
887 {
888 return $this->getReservedMysql();
889 }

References getReservedMysql().

+ Here is the call graph for this function:

◆ getAvailableTypes()

ilDBPdoFieldDefinition::getAvailableTypes ( )
Returns
string[]

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

1013 : array
1014 {
1016 }

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 1237 of file class.ilDBPdoFieldDefinition.php.

1237 : string
1238 {
1239 $db = $this->getDBInstance();
1240
1241 $notnull = empty($field['notnull']) ? '' : ' NOT NULL';
1242 $name = $db->quoteIdentifier($name, true);
1243
1244 return $name . ' ' . $this->getTypeDeclaration($field) . $notnull;
1245 }
if($format !==null) $name
Definition: metadata.php:247

References $name, getDBInstance(), and getTypeDeclaration().

+ Here is the call graph for this function:

◆ getBooleanDeclaration()

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

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

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

References getInternalDeclaration().

+ Here is the call graph for this function:

◆ getCharsetFieldDeclaration()

ilDBPdoFieldDefinition::getCharsetFieldDeclaration ( string  $charset)
protected

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

1201 : string
1202 {
1203 return '';
1204 }

Referenced by getDeclarationOptions().

+ Here is the caller graph for this function:

◆ getCLOBDeclaration()

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

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

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

References $name, getDBInstance(), and getTypeDeclaration().

+ Here is the call graph for this function:

◆ getCollationFieldDeclaration()

ilDBPdoFieldDefinition::getCollationFieldDeclaration ( string  $collation)
protected

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

1206 : string
1207 {
1208 return '';
1209 }

Referenced by getDeclarationOptions().

+ Here is the caller graph for this function:

◆ getDateDeclaration()

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

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

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

References getInternalDeclaration().

+ Here is the call graph for this function:

◆ getDBInstance()

◆ getDecimalDeclaration()

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

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

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

References getInternalDeclaration().

+ Here is the call graph for this function:

◆ getDeclaration()

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

ilDatabaseException

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

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

References $name, $type, and getDBInstance().

+ Here is the call graph for this function:

◆ getDeclarationOptions()

ilDBPdoFieldDefinition::getDeclarationOptions ( array  $field)
protected
Exceptions

ilDatabaseException

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

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

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

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 1214 of file class.ilDBPdoFieldDefinition.php.

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

References getInternalDeclaration().

+ Here is the call graph for this function:

◆ getInternalDeclaration()

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

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

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

References $name, 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 1042 of file class.ilDBPdoFieldDefinition.php.

1042 : array
1043 {
1044 return $this->max_length;
1045 }

References $max_length.

Referenced by checkColumnDefinition().

+ Here is the caller graph for this function:

◆ getQueryUtils()

ilDBPdoFieldDefinition::getQueryUtils ( )
protected

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

833 {
834 if ($this->query_utils === null) {
835 $this->query_utils = new ilMySQLQueryUtils($this->db_instance);
836 }
837
838 return $this->query_utils;
839 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $query_utils.

◆ getReservedMysql()

ilDBPdoFieldDefinition::getReservedMysql ( )
Returns
string[]

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

894 : array
895 {
897 }

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 1222 of file class.ilDBPdoFieldDefinition.php.

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

References getInternalDeclaration().

+ Here is the call graph for this function:

◆ getTimeDeclaration()

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

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

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

References getInternalDeclaration().

+ Here is the call graph for this function:

◆ getTimestampDeclaration()

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

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

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

References getInternalDeclaration().

+ Here is the call graph for this function:

◆ getTypeDeclaration()

ilDBPdoFieldDefinition::getTypeDeclaration ( array  $field)

Reimplemented in ilDBPdoMySQLFieldDefinition.

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

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

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 1060 of file class.ilDBPdoFieldDefinition.php.

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

References $type, $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 1005 of file class.ilDBPdoFieldDefinition.php.

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

References $type.

◆ isReserved()

ilDBPdoFieldDefinition::isReserved ( string  $table_name)

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

878 : bool
879 {
880 return false;
881 }

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], array($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 = array('type' => $type);
1714
1715 return call_user_func_array(
1716 $db->options['datatype_map_callback'][$type],
1717 array(&$db, __FUNCTION__, $parameter)
1718 );
1719 }
1720 }
1721
1722 return $type;
1723 }

References $type, and 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($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($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 }
string $key
Consumer key/client ID value.
Definition: System.php:193

References ILIAS\LTI\ToolProvider\$key, 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 1420 of file class.ilDBPdoFieldDefinition.php.

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

References $type, and 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 1496 of file class.ilDBPdoFieldDefinition.php.

1496 : string
1497 {
1498 return $this->quoteLOB($value, $quote, $escape_wildcards);
1499 }
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 1501 of file class.ilDBPdoFieldDefinition.php.

1501 : int
1502 {
1503 return ($value ? 1 : 0);
1504 }

◆ quoteCLOB()

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

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

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

References quoteLOB().

+ Here is the call graph for this function:

◆ quoteDate()

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

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

1506 : string
1507 {
1508 if ($value === 'CURRENT_DATE') {
1509 return 'CURRENT_DATE';
1510 }
1511
1512 return $this->quoteText($value, $quote, $escape_wildcards);
1513 }
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]/', $value) && strpos($value, ',')) {
1549 // 1000,00
1550 if (!strpos($value, '.')) {
1551 // convert the last "," to a "."
1552 $value = strrev(str_replace(',', '.', strrev($value)));
1553 // 1.000,00
1554 } elseif (strpos($value, '.') && strpos($value, '.') < strpos($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 1531 of file class.ilDBPdoFieldDefinition.php.

1531 : ?string
1532 {
1533 if (preg_match('/^(.*)e([-+])(\d+)$/i', $value, $matches)) {
1534 $decimal = $this->quoteDecimal($matches[1], $quote, $escape_wildcards);
1535 $sign = $matches[2];
1536 $exponent = str_pad($matches[3], 2, '0', STR_PAD_LEFT);
1537 $value = $decimal . 'E' . $sign . $exponent;
1538 } else {
1539 $value = $this->quoteDecimal($value, $quote, $escape_wildcards);
1540 }
1541
1542 return $value;
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 1428 of file class.ilDBPdoFieldDefinition.php.

1428 : int
1429 {
1430 return (int) $value;
1431 }

◆ quoteLOB()

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

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

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

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 1433 of file class.ilDBPdoFieldDefinition.php.

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

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 1526 of file class.ilDBPdoFieldDefinition.php.

1526 : string
1527 {
1528 throw new ilDatabaseException("deprecated");
1529 }

◆ quoteTimestamp()

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

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

1518 : string
1519 {
1520 throw new ilDatabaseException("deprecated");
1521 }

◆ readFile()

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

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

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

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($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 1037 of file class.ilDBPdoFieldDefinition.php.

1037 : void
1038 {
1039 $this->allowed_attributes = $allowed_attributes;
1040 }

References $allowed_attributes.

◆ setAvailableTypes()

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

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

1021 : void
1022 {
1023 $this->available_types = $available_types;
1024 }

References $available_types.

◆ setMaxLength()

ilDBPdoFieldDefinition::setMaxLength ( array  $max_length)

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

1047 : void
1048 {
1049 $this->max_length = $max_length;
1050 }

References $max_length.

◆ setReservedMysql()

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

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

902 : void
903 {
904 $this->reserved_mysql = $reserved_mysql;
905 }

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 61 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 48 of file class.ilDBPdoFieldDefinition.php.

◆ $available_types

◆ $db_instance

ilDBInterface ilDBPdoFieldDefinition::$db_instance
protected

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

Referenced by getDBInstance().

◆ $instance

ilDBPdoFieldDefinition ilDBPdoFieldDefinition::$instance
staticprotected

Definition at line 44 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 72 of file class.ilDBPdoFieldDefinition.php.

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

◆ $query_utils

ilMySQLQueryUtils ilDBPdoFieldDefinition::$query_utils = null
protected

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

Referenced by getQueryUtils().

◆ $reserved_mysql

array ilDBPdoFieldDefinition::$reserved_mysql
protected

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

Referenced by getReservedMysql(), and setReservedMysql().

◆ $reserved_postgres

array ilDBPdoFieldDefinition::$reserved_postgres
protected

Definition at line 722 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 841 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'

◆ 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: