ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilTableLock.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 {
27  protected bool $lock_sequence = false;
28  protected string $alias = '';
30  protected bool $checked = false;
31 
35  public function __construct(protected string $table_name, protected \ilDBInterface $ilDBInstance)
36  {
37  }
38 
42  public function check(): void
43  {
44  if (!in_array($this->getLockLevel(), [ilAtomQuery::LOCK_READ, ilAtomQuery::LOCK_WRITE], true)) {
46  }
47  if (!$this->getTableName() || !$this->ilDBInstance->tableExists($this->getTableName())) {
49  }
50 
51  $this->setChecked(true);
52  }
53 
54  public function lockSequence(bool $lock_bool): ilTableLockInterface
55  {
56  $this->setLockSequence($lock_bool);
57 
58  return $this;
59  }
60 
61  public function aliasName(string $alias_name): ilTableLockInterface
62  {
63  $this->setAlias($alias_name);
64 
65  return $this;
66  }
67 
68  public function getTableName(): string
69  {
70  return $this->table_name;
71  }
72 
73  public function setTableName(string $table_name): void
74  {
75  $this->table_name = $table_name;
76  }
77 
78  public function isLockSequence(): bool
79  {
80  return $this->lock_sequence;
81  }
82 
83  public function setLockSequence(bool $lock_sequence): void
84  {
85  $this->lock_sequence = $lock_sequence;
86  }
87 
88  public function getAlias(): string
89  {
90  return $this->alias;
91  }
92 
93  public function setAlias(string $alias): void
94  {
95  $this->alias = $alias;
96  }
97 
98  public function getLockLevel(): int
99  {
100  return $this->lock_level;
101  }
102 
103  public function setLockLevel(int $lock_level): void
104  {
105  $this->lock_level = $lock_level;
106  }
107 
108  public function isChecked(): bool
109  {
110  return $this->checked;
111  }
112 
113  public function setChecked(bool $checked): void
114  {
115  $this->checked = $checked;
116  }
117 }
setAlias(string $alias)
setLockSequence(bool $lock_sequence)
Class ilTableLock.
setLockLevel(int $lock_level)
lockSequence(bool $lock_bool)
Set true/false whether you would like to lock an existing sequence-table, too Without lockSequence(tr...
Class ilTableLockInterface Defines methods, which a Table-Lock used in ilAtomQuery provides...
Class ilAtomQueryException.
setChecked(bool $checked)
__construct(protected string $table_name, protected \ilDBInterface $ilDBInstance)
ilTableLock constructor.
aliasName(string $alias_name)
If you use Alias&#39; in your Queries which have to be locked by ilAtomQuery, "LOCK TABLE" needs to lock ...
setTableName(string $table_name)