ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
Wrapper.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
23 class Wrapper implements WrapperInterface
24 {
25  protected \ilDBInterface $db;
26 
27  public function __construct(\ilDBInterface $db)
28  {
29  $this->db = $db;
30  }
31 
32  public function nextID(string $table): int
33  {
34  return $this->db->nextId($table);
35  }
36 
37  public function insert(string $table, array $values): void
38  {
39  $this->db->insert($table, $values);
40  }
41 
42  public function update(string $table, array $values, array $where): void
43  {
44  $this->db->update($table, $values, $where);
45  }
46 
47  public function query(string $query): \Generator
48  {
49  $result = $this->db->query($query);
50 
51  while ($row = $result->fetchAssoc()) {
52  yield $row;
53  }
54  }
55 
56  public function manipulate(string $query): void
57  {
58  $this->db->manipulate($query);
59  }
60 
61  public function quoteAsInteger(string $value): string
62  {
63  return $this->db->quote($value, \ilDBConstants::T_INTEGER);
64  }
65 
66  public function quoteAsString(string $value): string
67  {
68  return $this->db->quote($value, \ilDBConstants::T_TEXT);
69  }
70 
71  public function in(string $field, string ...$values): string
72  {
73  return $this->db->in($field, $values, false, \ilDBConstants::T_TEXT);
74  }
75 }
in(string $field, string ... $values)
Definition: Wrapper.php:71
update(string $table, array $values, array $where)
Definition: Wrapper.php:42