19declare(strict_types=1);
37 protected ?PDO
$pdo =
null;
43 protected string $dsn =
'';
49 PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
58 public function connect(
bool $return_false_for_error =
false): ?bool
66 }
catch (Exception
$e) {
67 $this->error_code =
$e->getCode();
68 if ($return_false_for_error) {
74 return ($this->pdo->errorCode() === PDO::ERR_NONE);
108 public function createDatabase(
string $a_name,
string $a_charset =
"utf8",
string $a_collation =
""): bool
114 $this->
query($this->manager->getQueryUtils()->createDatabase($a_name, $a_charset, $a_collation));
116 }
catch (PDOException
$e) {
126 if ($this->pdo instanceof PDO) {
127 return $this->pdo->errorCode();
138 $clientIniFile =
$ini;
139 } elseif (
$DIC->offsetExists(
'ilClientIniFile')) {
140 $clientIniFile =
$DIC[
'ilClientIniFile'];
142 throw new InvalidArgumentException(
'$tmpClientIniFile is not an instance of ilIniFile');
145 $this->
setUsername($clientIniFile->readVariable(
"db",
"user"));
146 $this->
setHost($clientIniFile->readVariable(
"db",
"host"));
147 $this->
setPort((
int) $clientIniFile->readVariable(
"db",
"port"));
148 $this->
setPassword((
string) $clientIniFile->readVariable(
"db",
"pass"));
149 $this->
setDbname($clientIniFile->readVariable(
"db",
"name"));
150 $this->
setDBType($clientIniFile->readVariable(
"db",
"type"));
157 $port = $this->
getPort() !== 0 ?
";port=" . $this->
getPort() :
"";
164 public function quoteIdentifier(
string $identifier,
bool $check_option =
false): string
166 return '`' . preg_replace(
'/[^a-zA-Z0-9_$]/',
'', $identifier) .
'`';
172 abstract public function nextId(
string $table_name):
int;
180 bool $drop_table =
false,
181 bool $ignore_erros =
false
197 return $this->manager->createTable($table_name, $fields, array());
202 foreach ($a_cols as $col => $def) {
203 if (!$this->checkColumn($col, $def)) {
213 if (!$this->checkColumnName($a_col)) {
216 return $this->checkColumnDefinition($a_def);
221 return $this->field_definition->checkColumnDefinition($a_def);
226 return $this->field_definition->checkColumnName($a_name);
232 public function addPrimaryKey(
string $table_name, array $primary_keys): bool
234 assert(is_array($primary_keys));
237 foreach ($primary_keys as
$f) {
238 $fields[
$f] = array();
244 $this->manager->createConstraint(
246 $this->constraintName($table_name, $this->getPrimaryKeyIdentifier()),
258 foreach ($this->manager->listTableIndexes($table_name) as $idx_name) {
259 $def = $this->reverse->getTableIndexDefinition($table_name, $idx_name);
260 $idx_fields = array_keys($def[
'fields']);
262 if ($idx_fields === $fields) {
263 return $this->dropIndex($table_name, $idx_name);
277 $this->manager->createSequence($table_name, $start);
283 $result = $this->pdo->prepare(
"SHOW TABLES LIKE :table_name");
284 $result->execute(array(
'table_name' => $table_name));
285 $return = $result->rowCount();
286 $result->closeCursor();
295 return in_array($column_name, $fields,
true);
303 if (!$this->checkColumnName($column_name)) {
304 throw new ilDatabaseException(
"ilDB Error: addTableColumn(" . $table_name .
", " . $column_name .
")");
307 throw new ilDatabaseException(
"ilDB Error: addTableColumn(" . $table_name .
", " . $column_name .
")");
316 return $this->manager->alterTable($table_name, $changes,
false);
322 public function dropTable(
string $table_name,
bool $error_if_not_existing =
true): bool
325 $tables = $ilDBPdoManager->listTables();
326 $table_exists = in_array($table_name, $tables);
327 if (!$table_exists && $error_if_not_existing) {
332 $sequences = $ilDBPdoManager->listSequences();
333 if (in_array($table_name, $sequences)) {
334 $ilDBPdoManager->dropSequence($table_name);
339 $ilDBPdoManager->dropTable($table_name);
351 $ilBench =
$DIC[
'ilBench'] ??
null;
357 $ilBench->startDbBench(
$query);
361 $ilBench->stopDbBench();
363 }
catch (PDOException
$e) {
367 $err = $this->pdo->errorCode();
368 if ($err !== PDO::ERR_NONE) {
369 $info = $this->pdo->errorInfo();
370 $info_message = $info[2];
380 while (
$data = $statement->
fetch($fetch_mode)) {
389 $this->manager->dropSequence($table_name);
400 $column_name => array(),
404 return $this->manager->alterTable($table_name, $changes,
false);
410 public function renameTableColumn(
string $table_name,
string $column_old_name,
string $column_new_name): bool
413 if (!$this->checkColumnName($column_new_name)) {
414 throw new ilDatabaseException(
"ilDB Error: renameTableColumn(" . $table_name .
"," . $column_old_name .
"," . $column_new_name .
")");
417 $def = $this->reverse->getTableFieldDefinition($table_name, $column_old_name);
420 $best_alt = $analyzer->getBestDefinitionAlternative($def);
421 $def = $def[$best_alt];
422 unset($def[
"nativetype"]);
423 unset($def[
"mdb2type"]);
425 $f[
"definition"] = $def;
426 $f[
"name"] = $column_new_name;
430 $column_old_name =>
$f,
434 return $this->manager->alterTable($table_name, $changes,
false);
437 public function insert(
string $table_name, array $values):
int
441 foreach ($values as
$key => $val) {
442 $real[] = $this->quote($val[1], $val[0]);
443 $fields[] = $this->quoteIdentifier(
$key);
445 $values_string = implode(
",", $real);
446 $fields_string = implode(
",", $fields);
447 $query =
"INSERT INTO " . $this->quoteIdentifier($table_name) .
" (" . $fields_string .
") VALUES (" . $values_string .
")";
449 $query = $this->sanitizeMB4StringIfNotSupported(
$query);
451 return (
int) $this->pdo->exec(
$query);
458 $query_result->closeCursor();
466 public function update(
string $table_name, array $columns, array $where):
int
469 $field_values = array();
470 $placeholders = array();
471 $placeholders_full = array();
476 foreach ($columns as $k => $col) {
477 $field_value = $col[1];
479 $placeholders[] =
"%s";
480 $placeholders_full[] =
":$k";
483 if (($col[0] ===
"blob" || $col[0] ===
"clob" || $col[0] ===
'text') && is_string($field_value)) {
484 $field_value = $this->sanitizeMB4StringIfNotSupported($field_value);
488 if ($col[0] ===
'integer' && !is_null($field_value)) {
489 $field_value = (
int) $field_value;
492 $values[] = $field_value;
493 $field_values[$k] = $field_value;
494 if ($col[0] ===
"blob" || $col[0] ===
"clob") {
500 $q =
"UPDATE " . $this->quoteIdentifier($table_name) .
" SET ";
502 foreach ($fields as $k => $field) {
503 $q .= $lim . $this->quoteIdentifier($field) .
" = " . $placeholders_full[$k];
508 foreach ($where as $k => $col) {
509 $q .= $lim . $this->quoteIdentifier($k) .
" = " . $this->quote($col[1], $col[0]);
513 $r = $this->prepareManip($q, $types);
514 $this->execute($r, $field_values);
516 $num_affected_rows = $r->rowCount();
520 foreach ($where as $k => $col) {
523 $field_values[$k] = $col;
525 $q =
"UPDATE " . $this->quoteIdentifier($table_name) .
" SET ";
527 foreach ($fields as $k => $field) {
528 $q .= $lim . $this->quoteIdentifier($field) .
" = " . $placeholders[$k];
533 foreach (array_keys($where) as $k) {
534 $q .= $lim . $this->quoteIdentifier($k) .
" = %s";
538 $num_affected_rows = $this->manipulateF($q, $types, $values);
541 return $num_affected_rows;
550 $ilBench =
$DIC[
'ilBench'] ??
null;
552 $query = $this->sanitizeMB4StringIfNotSupported(
$query);
554 $ilBench->startDbBench(
$query);
556 $num_affected_rows = $this->pdo->exec(
$query);
558 $ilBench->stopDbBench();
560 }
catch (PDOException
$e) {
564 return (
int) $num_affected_rows;
569 $res = $statement->
fetch(PDO::FETCH_ASSOC);
570 if (
$res ===
null ||
$res ===
false) {
571 $statement->closeCursor();
586 if ($value ===
null) {
590 $pdo_type = PDO::PARAM_STR;
598 if ($value === $this->now()) {
601 $value = (string) $value;
604 return (
string) (
int) $value;
606 $pdo_type = PDO::PARAM_INT;
607 $value = (string) $value;
611 $value = (string) $value;
612 $pdo_type = PDO::PARAM_STR;
616 return $this->pdo->quote((
string) $value, $pdo_type);
621 foreach ($this->manager->listTableIndexes($table_name) as $idx_name) {
622 $def = $this->reverse->getTableIndexDefinition($table_name, $idx_name);
623 $idx_fields = array_keys($def[
'fields']);
625 if ($idx_fields === $fields) {
633 public function addIndex(
string $table_name, array $fields,
string $index_name =
'',
bool $fulltext =
false): bool
635 assert(is_array($fields));
636 $this->field_definition->checkIndexName($index_name);
638 $definition_fields = array();
639 foreach ($fields as
$f) {
640 $definition_fields[
$f] = array();
643 'fields' => $definition_fields,
647 $this->manager->createIndex($table_name, $this->constraintName($table_name, $index_name), $definition);
648 } elseif ($this->supportsFulltext()) {
649 $this->addFulltextIndex($table_name, $fields, $index_name);
659 public function addFulltextIndex(
string $table, array $fields,
string $a_name =
"in"): bool
661 $i_name = $this->constraintName($table, $a_name) .
"_idx";
662 $f_str = implode(
",", $fields);
663 $q =
"ALTER TABLE $table ADD FULLTEXT $i_name ($f_str)";
673 $i_name = $this->constraintName($a_table, $a_name) .
"_idx";
674 $this->query(
"ALTER TABLE $a_table DROP FULLTEXT $i_name");
683 $set = $this->query(
"SHOW INDEX FROM " . $a_table);
684 while ($rec = $this->fetchAssoc($set)) {
685 if ($rec[
"Key_name"] === $a_name && $rec[
"Index_type"] ===
"FULLTEXT") {
709 return $a_constraint;
719 return $this->db_type;
724 $this->db_type =
$type;
732 public static function getReservedWords(): array
740 $fd =
$ilDB->getFieldDefinition();
742 return $fd->getReservedMysql();
752 assert(is_array($tables));
753 $lock = $this->manager->getQueryUtils()->lock($tables);
754 $this->pdo->exec($lock);
763 $this->pdo->exec($this->manager->getQueryUtils()->unlock());
766 public function in(
string $field, array $values,
bool $negate =
false,
string $type =
""): string
768 return $this->manager->getQueryUtils()->in($field, $values, $negate,
$type);
777 if (!is_array($types) || !is_array($values) || count($types) !== count($values)) {
778 throw new ilDatabaseException(
"ilDB::queryF: Types and values must be arrays of same size. ($query)");
780 $quoted_values = array();
781 foreach ($types as $k => $t) {
782 $quoted_values[] = $this->quote($values[$k], $t);
786 return $this->query(
$query);
795 if (!is_array($types) || !is_array($values) || count($types) !== count($values)) {
796 throw new ilDatabaseException(
"ilDB::manipulateF: types and values must be arrays of same size. ($query)");
798 $quoted_values = array();
799 foreach ($types as $k => $t) {
800 $quoted_values[] = $this->quote($values[$k], $t);
804 return $this->manipulate(
$query);
818 public function setLimit(
int $limit,
int $offset = 0): void
820 $this->limit = $limit;
821 $this->offset = $offset;
827 public function like(
string $column,
string $type,
string $value =
"?",
bool $case_insensitive =
true): string
829 return $this->manager->getQueryUtils()->like($column,
$type, $value, $case_insensitive);
835 public function now(): string
837 return $this->manager->getQueryUtils()->now();
840 public function replace(
string $table, array $primary_keys, array $other_columns):
int
842 $a_columns = array_merge($primary_keys, $other_columns);
848 foreach ($a_columns as $k => $col) {
849 $fields[] = $this->quoteIdentifier($k);
850 $placeholders[] =
"%s";
851 $placeholders2[] =
":$k";
855 if ($col[0] ===
'integer' && !is_null($col[1])) {
856 $col[1] = (
int) $col[1];
862 $q =
"REPLACE INTO " . $table .
" (" . implode(
",", $fields) .
") VALUES (" . implode(
",", $placeholders) .
")";
864 return $this->manipulateF($q, $types, $values);
870 public function equals(
string $columns, $value,
string $type,
bool $emptyOrNull =
false): string
872 if (!$emptyOrNull || $value !=
"") {
873 return $columns .
" = " . $this->quote($value,
$type);
876 return "(" . $columns .
" = '' OR $columns IS NULL)";
891 return $this->dbname;
896 $this->dbname = $dbname;
901 return $this->charset;
906 $this->charset = $charset;
911 return $this->username;
916 $this->username = $username;
921 return $this->password;
926 $this->password = $password;
941 $this->setUsername($user);
946 $this->setPort($port);
951 $this->setPassword($password);
956 $this->setHost($host);
962 public function upper(
string $expression): string
964 return " UPPER(" . $expression .
") ";
970 public function lower(
string $expression): string
972 return " LOWER(" . $expression .
") ";
975 public function substr(
string $a_exp,
int $a_pos = 1,
int $a_len = -1): string
979 $lenstr =
", " . $a_len;
981 return " SUBSTR(" . $a_exp .
", " . $a_pos . $lenstr .
") ";
996 $this->pdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, $a_status);
1008 if ($result ===
false) {
1009 throw new ilDatabaseException(implode(
', ', $stmt->errorInfo()), (
int) $stmt->errorCode());
1032 case self::FEATURE_TRANSACTIONS:
1033 return $this->supportsTransactions();
1034 case self::FEATURE_FULLTEXT:
1035 return $this->supportsFulltext();
1036 case self::FEATURE_SLAVE:
1037 return $this->supportsSlave();
1048 return $this->manager->listTables();
1058 return $this->manager;
1060 return $this->reverse;
1062 throw new LogicException(
'module "' . $module .
'" not available');
1070 return $this->field_definition->getAllowedAttributes();
1075 return in_array($sequence, $this->listSequences(),
true);
1080 return $this->manager->listSequences();
1083 public function concat(array $values,
bool $allow_null =
true): string
1085 return $this->manager->getQueryUtils()->concat($values, $allow_null);
1090 if ($this->limit !==
null && $this->offset !==
null) {
1091 $query .=
' LIMIT ' . $this->offset .
', ' . $this->limit;
1092 $this->limit =
null;
1093 $this->offset =
null;
1101 public function locate(
string $needle,
string $string,
int $start_pos = 1): string
1103 return $this->manager->getQueryUtils()->locate($needle, $string, $start_pos);
1111 $def = $this->reverse->getTableFieldDefinition($table, $column);
1114 $best_alt = $analyzer->getBestDefinitionAlternative($def);
1115 $def = $def[$best_alt];
1116 unset($def[
"nativetype"], $def[
"mdb2type"]);
1119 $ilDBPdoFieldDefinition = $this->field_definition;
1123 foreach (array_keys($def) as $k) {
1124 if ($k !==
"type" && !$ilDBPdoFieldDefinition->isAllowedAttribute($k,
$type)) {
1128 $check_array = $def;
1130 $check_array[$k] = $v;
1132 if (!$this->checkColumnDefinition($check_array,
true)) {
1133 throw new ilDatabaseException(
"ilDB Error: modifyTableColumn(" . $table .
", " . $column .
")");
1148 return $this->manager->alterTable($table, $changes,
false);
1153 $a_st->closeCursor();
1163 $this->checkTableName($new_name);
1166 "ilDB Error: renameTable(" .
$name .
"," . $new_name .
")<br />" .
$e->getMessage(),
1171 $this->manager->alterTable(
$name, [
"name" => $new_name],
false);
1172 if ($this->sequenceExists(
$name)) {
1173 $this->manager->alterTable(
1174 $this->getSequenceName(
$name),
1175 [
"name" => $this->getSequenceName($new_name)],
1192 return $this->field_definition->checkTableName($a_name);
1206 if (!$this->supports(self::FEATURE_TRANSACTIONS)) {
1210 return $this->pdo->beginTransaction();
1218 if (!$this->supports(self::FEATURE_TRANSACTIONS)) {
1222 return $this->pdo->commit();
1230 if (!$this->supports(self::FEATURE_TRANSACTIONS)) {
1234 return $this->pdo->rollBack();
1237 public function dropIndex(
string $a_table,
string $a_name =
"i1"): bool
1239 return $this->manager->dropIndex($a_table, $a_name);
1244 $this->storage_engine = $storage_engine;
1249 return $this->storage_engine;
1256 $type = PDO::FETCH_ASSOC;
1259 $type = PDO::FETCH_OBJ;
1262 $type = PDO::FETCH_ASSOC;
1266 return $this->pdo->query(
$query, PDO::FETCH_ASSOC)->fetchAll(PDO::FETCH_COLUMN, $colnum);
1271 ?array $types =
null,
1274 switch ($fetchmode) {
1276 $type = PDO::FETCH_ASSOC;
1279 $type = PDO::FETCH_OBJ;
1282 $type = PDO::FETCH_ASSOC;
1291 return $this->pdo->query(
'SELECT VERSION()')->fetchColumn();
1294 public function escape(
string $value,
bool $escape_wildcards =
false): string
1335 $fd = $this->getFieldDefinition();
1337 return $fd->checkIndexName(
$name);
1347 assert(is_array($fields));
1348 $manager = $this->manager;
1351 if (!$this->checkIndexName(
$name)) {
1355 $fields_corrected = array();
1356 foreach ($fields as
$f) {
1357 $fields_corrected[
$f] = array();
1359 $definition = array(
1361 'fields' => $fields_corrected,
1369 return $this->manager->dropConstraint($table, $this->constraintName($table,
$name),
false);
1375 $cons = $analyzer->getConstraintsInformation($table);
1376 foreach ($cons as
$c) {
1377 if (
$c[
"type"] ===
"unique" && count($fields) === count(
$c[
"fields"])) {
1379 foreach ($fields as
$f) {
1380 if (!isset(
$c[
"fields"][
$f])) {
1385 return $this->dropUniqueConstraint($table,
$c[
'name']);
1395 return (
int) $this->pdo->lastInsertId();
1406 $cons = $analyzer->getConstraintsInformation($table);
1407 foreach ($cons as
$c) {
1408 if (
$c[
"type"] ===
"unique" && count($fields) === count(
$c[
"fields"])) {
1410 foreach ($fields as
$f) {
1411 if (!isset(
$c[
"fields"][
$f])) {
1426 return $this->manager->dropConstraint($table_name,
"PRIMARY",
true);
1431 foreach (
$data as $set) {
1432 $this->execute($stmt, $set);
1439 return "FROM_UNIXTIME(" . $expr .
")";
1444 return "UNIX_TIMESTAMP()";
1453 $d = $this->fetchObject($this->query(
"SELECT VERSION() AS version"));
1455 if (
$d !==
null &&
$d->version) {
1466 if (!$this->doesCollationSupportMB4Strings()) {
1467 $query_replaced = preg_replace(
1468 '/[\x{10000}-\x{10FFFF}]/u',
1472 if (!empty($query_replaced)) {
1473 return $query_replaced;
1491 public function groupConcat(
string $a_field_name,
string $a_seperator =
",", ?
string $a_order =
null): string
1493 return $this->manager->getQueryUtils()->groupConcat($a_field_name, $a_seperator, $a_order);
1499 public function cast(
string $a_field_name,
string $a_dest_type): string
1501 return $this->manager->getQueryUtils()->cast($a_field_name, $a_dest_type);
1506 $constraints = $this->manager->listTableConstraints($table_name);
1508 if (in_array(
'primary', $constraints)) {
1509 $definitions = $this->reverse->getTableConstraintDefinition($table_name,
'primary');
1510 $primary_fields = array_keys($definitions[
'fields']);
1511 sort($primary_fields);
1514 return $primary_fields === $fields;
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const MYSQL_ENGINE_INNODB
const MYSQL_COLLATION_UTF8MB4
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
createConstraint(string $table, string $name, array $definition)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
renameTable(string $name, string $new_name)
fetchAll(ilDBStatement $statement, int $fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
setUsername(string $username)
dropUniqueConstraintByFields(string $table, array $fields)
checkColumnName(string $a_name)
setLimit(int $limit, int $offset=0)
Set the Limit for the next Query.
createTable(string $table_name, array $fields, bool $drop_table=false, bool $ignore_erros=false)
in(string $field, array $values, bool $negate=false, string $type="")
tableExists(string $table_name)
manipulateF(string $query, array $types, array $values)
dropTable(string $table_name, bool $error_if_not_existing=true)
sanitizeMB4StringIfNotSupported(string $query)
string sanitized query
isFulltextIndex(string $a_table, string $a_name)
Is index a fulltext index?
numRows(ilDBStatement $statement)
setStorageEngine(string $storage_engine)
escapePattern(string $text)
free(ilDBStatement $a_st)
connect(bool $return_false_for_error=false)
insert(string $table_name, array $values)
fromUnixtime(string $expr, bool $to_text=true)
groupConcat(string $a_field_name, string $a_seperator=",", ?string $a_order=null)
enableResultBuffering(bool $a_status)
checkIndexName(string $name)
dropIndex(string $a_table, string $a_name="i1")
addPrimaryKey(string $table_name, array $primary_keys)
substr(string $a_exp, int $a_pos=1, int $a_len=-1)
queryF(string $query, array $types, array $values)
supportsEngineMigration()
getPrimaryKeyIdentifier()
executeMultiple(ilDBStatement $stmt, array $data)
getAllowedAttributes()
string[]
checkTableName(string $a_name)
setDBPassword(string $password)
addFulltextIndex(string $table, array $fields, string $a_name="in")
sequenceExists(string $sequence)
escape(string $value, bool $escape_wildcards=false)
getServerVersion(bool $native=false)
modifyTableColumn(string $table, string $column, array $attributes)
addUniqueConstraint(string $table, array $fields, string $name="con")
migrateAllTablesToCollation(string $collation=ilDBConstants::MYSQL_COLLATION_UTF8MB4)
@inheritDoc
setCharset(string $charset)
dropFulltextIndex(string $a_table, string $a_name)
Drop fulltext index.
getAdditionalAttributes()
dropUniqueConstraint(string $table, string $name="con")
addIndex(string $table_name, array $fields, string $index_name='', bool $fulltext=false)
getSequenceName(string $table_name)
setFieldDefinition(\ilDBPdoFieldDefinition $field_definition)
createSequence(string $table_name, int $start=1)
dropPrimaryKey(string $table_name)
supportsCollationMigration()
@inheritDoc
appendLimit(string $query)
prepareManip(string $query, ?array $types=null)
loadModule(string $module)
queryCol(string $query, int $type=PDO::FETCH_ASSOC, int $colnum=0)
setDbname(string $dbname)
indexExistsByFields(string $table_name, array $fields)
concat(array $values, bool $allow_null=true)
renameTableColumn(string $table_name, string $column_old_name, string $column_new_name)
equals(string $columns, $value, string $type, bool $emptyOrNull=false)
lockTables(array $tables)
checkColumn(string $a_col, array $a_def)
migrateAllTablesToEngine(string $engine=ilDBConstants::MYSQL_ENGINE_INNODB)
primaryExistsByFields(string $table_name, array $fields)
prepare(string $query, ?array $types=null, ?array $result_types=null)
ilDBPdoFieldDefinition $field_definition
like(string $column, string $type, string $value="?", bool $case_insensitive=true)
dropIndexByFields(string $table_name, array $fields)
quoteIdentifier(string $identifier, bool $check_option=false)
doesCollationSupportMB4Strings()
@inheritDoc
const FEATURE_TRANSACTIONS
dropTableColumn(string $table_name, string $column_name)
createDatabase(string $a_name, string $a_charset="utf8", string $a_collation="")
getIndexName(string $index_name_base)
manipulate(string $query)
addTableColumn(string $table_name, string $column_name, array $attributes)
constraintName(string $a_table, string $a_constraint)
Determine contraint name by table name and constraint name.
useSlave(bool $bool)
TODO.
fetchAssoc(ilDBStatement $statement)
checkTableColumns(array $a_cols)
replace(string $table, array $primary_keys, array $other_columns)
Replace into method.
locate(string $needle, string $string, int $start_pos=1)
checkColumnDefinition(array $a_def, bool $a_modify_mode=false)
upper(string $expression)
dropSequence(string $table_name)
uniqueConstraintExists(string $table, array $fields)
nextId(string $table_name)
cast(string $a_field_name, string $a_dest_type)
fetchObject(ilDBStatement $query_result)
update(string $table_name, array $columns, array $where)
@description $where MUST contain existing columns only.
static isReservedWord(string $a_word)
supports(string $feature)
setPassword(string $password)
tableColumnExists(string $table_name, string $column_name)
queryRow(string $query, ?array $types=null, int $fetchmode=ilDBConstants::FETCHMODE_DEFAULT)
initFromIniFile(?ilIniFile $ini=null)
quote($value, ?string $type=null)
lower(string $expression)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilPDOStatement is a Wrapper Class for PDOStatement.
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilDBPdoInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
execute(array $a_data=null)
fetch(int $fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples