107 $ilTableLock =
new ilTableLock($table_name, $this->ilDBInstance);
109 $this->tables[] = $ilTableLock;
180 abstract public function run();
202 static::checkAnomaly($anomaly);
247 if (!in_array($anomalie, self::$possible_anomalies)) {
258 if ((is_array($this->query) && 0 === count($this->query)) && !($this->query instanceof \Traversable)) {
262 foreach ($this->query as
$query) {
276 if (!is_callable(
$query)) {
285 $classname = get_class(
$query);
286 $is_a_closure = $classname ==
'Closure';
287 if (!$is_a_closure) {
288 $ref =
new ReflectionClass(
$query);
289 foreach ($ref->getMethods() as $method) {
290 if ($method->getName() ==
'__invoke') {
298 $ref =
new ReflectionFunction(
$query);
299 $parameters = $ref->getParameters();
300 if (count($parameters) !== 1) {
303 $reflectionClass = $parameters[0]->getClass();
304 if ($reflectionClass && $reflectionClass->getName() ==
'ilDBInterface') {
318 protected function hasWriteLocks()
320 $has_write_locks =
false;
324 foreach ($this->tables as $table) {
326 $has_write_locks =
true;
330 return $has_write_locks;
340 $query($this->ilDBInstance);
355 if (count($this->tables) === 0) {
An exception for terminatinating execution or to throw for unit testing.
addTableLock($table_name)
Add table-names which are influenced by your queries, MyISAm has to lock those tables.
static getPossibleAnomalies($isolation_level)
__construct(ilDBInterface $ilDBInstance, $isolation_level=ilAtomQuery::ISOLATION_SERIALIZABLE)
ilAtomQuery constructor.
static checkAnomaly($anomalie)
static checkIsolationLevel($isolation_level)
static $possible_anomalies
addQueryCallable(callable $query)
All action on the database during this isolation has to be passed as Callable to ilAtomQuery.
checkCallable(callable $query)
static isThereRiskThat($isolation_level, $anomaly)
static $available_isolations_levels
replaceQueryCallable(callable $query)
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