19declare(strict_types=1);
106 $ilTableLock =
new ilTableLock($table_name, $this->ilDBInstance);
108 $this->tables[] = $ilTableLock;
159 abstract public function run(): void;
172 static::checkAnomaly($anomaly);
211 if (!in_array($anomaly, self::$possible_anomalies)) {
221 if (!($this->query instanceof \Traversable) && (is_array($this->query) && [] === $this->query)) {
225 foreach ($this->query as
$query) {
234 if (!is_callable(
$query)) {
244 $is_a_closure = (
$query instanceof Closure);
245 if (!$is_a_closure) {
246 $ref =
new ReflectionClass(
$query);
247 foreach ($ref->getMethods() as $method) {
248 if ($method->getName() ===
'__invoke') {
256 $ref =
new ReflectionFunction(
$query);
257 $parameters = $ref->getParameters();
258 if (count($parameters) !== 1) {
261 $reflectionClass = $parameters[0]->getType();
262 return $reflectionClass && $reflectionClass->getName() === ilDBInterface::class;
270 $has_write_locks =
false;
271 foreach ($this->tables as $table) {
273 $has_write_locks =
true;
277 return $has_write_locks;
286 $query($this->ilDBInstance);
300 if ($this->tables === []) {
Class ilAtomQuery Use ilAtomQuery to fire Database-Actions which have to be done without beeing influ...
addTableLock(string $table_name)
Add table-names which are influenced by your queries, MyISAm has to lock those tables.
static getPossibleAnomalies(int $isolation_level)
__construct(protected \ilDBInterface $ilDBInstance, int $isolation_level=ilAtomQuery::ISOLATION_SERIALIZABLE)
ilAtomQuery constructor.
static checkAnomaly(int $anomaly)
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)
static array $anomalies_map
Class ilAtomQueryException.
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
const ISOLATION_READ_COMMITED
const ISOLATION_REPEATED_READ
const ISOLATION_READ_UNCOMMITED
const ISOLATION_SERIALIZABLE
const ANO_NON_REPEATED_READ
Class ilTableLockInterface Defines methods, which a Table-Lock used in ilAtomQuery provides.