3 declare(strict_types=1);
    30     public function in(
string $field, array $values, 
bool $negate = 
false, 
string $type = 
""): string
    32         if (!is_array($values) || count($values) === 0) {
    35             return $negate ? 
' 1=1 ' : 
' 1=2 ';
    39             $str = $field . (($negate) ? 
" NOT" : 
"") . 
" IN (?" . str_repeat(
",?", count($values) - 1) . 
")";
    41             $str = $field . (($negate) ? 
" NOT" : 
"") . 
" IN (";
    43             foreach ($values as $v) {
    44                 $str .= $sep . $this->
quote($v, $type);
    56     public function quote($value, ?
string $type = null): string
    58         return $this->db_instance->quote($value, $type);
    61     public function concat(array $values, 
bool $allow_null = 
true): string
    63         if (count($values) === 0) {
    69         foreach ($values as $field_info) {
    70             $val = $field_info[0];
    77                 $concat .= 
'COALESCE(';
    89         return $concat . 
') ';
    92     public function locate(
string $a_needle, 
string $a_string, 
int $a_start_pos = 1): string
    94         $locate = 
' LOCATE( ';
    99         $locate .= $a_start_pos;
   114         return $this->db_instance->quoteIdentifier($identifier);
   120     public function createTable(
string $name, array $fields, array $options = []): string
   125         if (empty($fields)) {
   128         $query_fields_array = [];
   129         $fd = $this->db_instance->getFieldDefinition();
   131             foreach ($fields as $field_name => $field) {
   132                 $query_fields_array[] = $fd->getDeclaration(
   140         $query_fields = implode(
', ', $query_fields_array);
   142         if (!empty($options[
'primary'])) {
   143             $query_fields .= 
', PRIMARY KEY (' . implode(
', ', array_keys($options[
'primary'])) . 
')';
   146         $query = 
"CREATE  TABLE $name ($query_fields)";
   148         $options_strings = array();
   150         if (!empty($options[
'comment'])) {
   151             $options_strings[
'comment'] = 
'COMMENT = ' . $this->
quote($options[
'comment'], 
'text');
   154         if (!empty($options[
'charset'])) {
   155             $options_strings[
'charset'] = 
'DEFAULT CHARACTER SET ' . $options[
'charset'];
   156             if (!empty($options[
'collate'])) {
   157                 $options_strings[
'charset'] .= 
' COLLATE ' . $options[
'collate'];
   162         if (!empty($options[
'type'])) {
   163             $type = $options[
'type'];
   166             $options_strings[] = 
"ENGINE = $type";
   169         if (!empty($options_strings)) {
   170             $query .= 
' ' . implode(
' ', $options_strings);
   179     public function like(
string $column, 
string $type, 
string $value = 
"?", 
bool $case_insensitive = 
true): string
   181         if (!in_array($type, array(
   189         if ($value === 
"?") {
   190             if ($case_insensitive) {
   191                 return "UPPER(" . $column . 
") LIKE(UPPER(?))";
   194             return $column . 
" LIKE(?)";
   197         if ($case_insensitive) {
   199             return " UPPER(" . $column . 
") LIKE(UPPER(" . $this->
quote($value, 
'text') . 
"))";
   203         return " " . $column . 
" LIKE(" . $this->
quote($value, 
'text') . 
")";
   206     public function now(): string
   211     public function lock(array $tables): string
   213         $lock = 
'LOCK TABLES ';
   216         foreach ($tables as $table) {
   217             if ($counter++ !== 0) {
   221             if (isset($table[
'sequence']) && $table[
'sequence']) {
   222                 $table_name = $this->db_instance->getSequenceName($table[
'name']);
   224                 $table_name = $table[
'name'];
   227             $lock .= ($table_name . 
' ');
   229             if ($table[
'alias'] ?? null) {
   230                 $lock .= ($table[
'alias'] . 
' ');
   233             switch ($table[
'type']) {
   249         return 'UNLOCK TABLES';
   252     public function createDatabase(
string $name, 
string $charset = 
"utf8", 
string $collation = 
""): string
   254         if ($collation !== 
"") {
   255             $sql = 
"CREATE DATABASE `" . $name . 
"` CHARACTER SET " . $charset . 
" COLLATE " . $collation;
   257             $sql = 
"CREATE DATABASE `" . $name . 
"` CHARACTER SET " . $charset;
   263     public function groupConcat(
string $field_name, 
string $seperator = 
",", 
string $order = null): string
   265         if ($order === null) {
   266             $sql = 
"GROUP_CONCAT(" . $field_name . 
" SEPARATOR " . $this->
quote($seperator, 
"text") . 
")";
   268             $sql = 
"GROUP_CONCAT(" . $field_name . 
" ORDER BY " . $order . 
" SEPARATOR " . $this->
quote(
   279     public function cast(
string $a_field_name, $a_dest_type): string
   281         return $a_field_name;
 in(string $field, array $values, bool $negate=false, string $type="")
 
Class ilPDOStatement is a Wrapper Class for PDOStatement. 
 
concat(array $values, bool $allow_null=true)
 
locate(string $a_needle, string $a_string, int $a_start_pos=1)
 
groupConcat(string $field_name, string $seperator=",", string $order=null)
 
quoteIdentifier(string $identifier)
 
quote($value, ?string $type=null)
 
free(ilPDOStatement $statement)
 
like(string $column, string $type, string $value="?", bool $case_insensitive=true)
 
closeCursor()
Pdo allows for a manual closing of the cursor. 
 
createDatabase(string $name, string $charset="utf8", string $collation="")
 
createTable(string $name, array $fields, array $options=[])
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
cast(string $a_field_name, $a_dest_type)
 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...