2require_once(
'./Services/Database/interfaces/interface.ilAtomQuery.php');
3require_once(
'./Services/Database/classes/Atom/class.ilTableLock.php');
106 $ilTableLock =
new ilTableLock($table_name, $this->ilDBInstance);
108 $this->tables[] = $ilTableLock;
176 abstract public function run();
196 static::checkAnomaly($anomaly);
238 if (!in_array($anomalie, self::$possible_anomalies)) {
248 if (count($this->query) == 0) {
251 foreach ($this->query as
$query) {
264 if (!is_callable(
$query)) {
273 $classname = get_class(
$query);
274 $is_a_closure = $classname ==
'Closure';
275 if (!$is_a_closure) {
276 $ref =
new ReflectionClass(
$query);
277 foreach ($ref->getMethods() as $method) {
278 if ($method->getName() ==
'__invoke') {
286 $ref =
new ReflectionFunction(
$query);
287 $parameters = $ref->getParameters();
288 if (count($parameters) !== 1) {
291 $reflectionClass = $parameters[0]->getClass();
292 if ($reflectionClass && $reflectionClass->getName() ==
'ilDBInterface') {
306 protected function hasWriteLocks() {
307 $has_write_locks =
false;
311 foreach ($this->tables as $table) {
313 $has_write_locks =
true;
317 return $has_write_locks;
326 $query($this->ilDBInstance);
340 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