3declare(strict_types=1);
108 $ilTableLock =
new ilTableLock($table_name, $this->ilDBInstance);
110 $this->tables[] = $ilTableLock;
161 abstract public function run(): void;
174 static::checkAnomaly($anomaly);
213 if (!in_array($anomaly, self::$possible_anomalies)) {
223 if (!($this->query instanceof \Traversable) && (is_array($this->query) && 0 === count($this->query))) {
227 foreach ($this->query as
$query) {
236 if (!is_callable(
$query)) {
246 $is_a_closure = (
$query instanceof Closure);
247 if (!$is_a_closure) {
248 $ref =
new ReflectionClass(
$query);
249 foreach ($ref->getMethods() as $method) {
250 if ($method->getName() ===
'__invoke') {
258 $ref =
new ReflectionFunction(
$query);
259 $parameters = $ref->getParameters();
260 if (count($parameters) !== 1) {
263 $reflectionClass = $parameters[0]->getType();
264 return $reflectionClass && $reflectionClass->getName() === ilDBInterface::class;
272 $has_write_locks =
false;
273 foreach ($this->tables as $table) {
275 $has_write_locks =
true;
279 return $has_write_locks;
288 $query($this->ilDBInstance);
302 if (count($this->tables) === 0) {
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addTableLock(string $table_name)
Add table-names which are influenced by your queries, MyISAm has to lock those tables.
static getPossibleAnomalies(int $isolation_level)
static checkAnomaly(int $anomaly)
__construct(ilDBInterface $ilDBInstance, int $isolation_level=ilAtomQuery::ISOLATION_SERIALIZABLE)
ilAtomQuery constructor.
static array $possible_anomalies
static array $available_isolations_levels
static checkIsolationLevel(int $isolation_level)
static isThereRiskThat(int $isolation_level, int $anomaly)
addQueryCallable(callable $query)
All action on the database during this isolation has to be passed as Callable to ilAtomQuery.
checkCallable(callable $query)
replaceQueryCallable(callable $query)
ilDBInterface $ilDBInstance
static array $anomalies_map
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const DB_ATOM_ISO_WRONG_LEVEL
const DB_ATOM_CLOSURE_NONE
const DB_ATOM_LOCK_WRONG_LEVEL
const DB_ATOM_ANO_NOT_AVAILABLE
const DB_ATOM_LOCK_NO_TABLE
const DB_ATOM_CLOSURE_ALREADY_SET
const DB_ATOM_CLOSURE_WRONG_FORMAT
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ISOLATION_READ_COMMITED
const ISOLATION_REPEATED_READ
const ISOLATION_READ_UNCOMMITED
const ISOLATION_SERIALIZABLE
const ANO_NON_REPEATED_READ
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...