2 require_once(
'./Services/Database/interfaces/interface.ilAtomQuery.php');
3 require_once(
'./Services/Database/classes/Atom/class.ilTableLock.php');
109 $ilTableLock =
new ilTableLock($table_name, $this->ilDBInstance);
111 $this->tables[] = $ilTableLock;
182 abstract public function run();
204 static::checkAnomaly($anomaly);
249 if (!in_array($anomalie, self::$possible_anomalies)) {
260 if ((is_array($this->query) && 0 === count($this->query)) && !($this->query instanceof \Traversable)) {
264 foreach ($this->query as
$query) {
278 if (!is_callable($query)) {
281 if (is_array($query)) {
284 if (is_string($query)) {
287 $classname = get_class($query);
288 $is_a_closure = $classname ==
'Closure';
289 if (!$is_a_closure) {
291 foreach ($ref->getMethods() as $method) {
292 if ($method->getName() ==
'__invoke') {
300 $ref =
new ReflectionFunction($query);
301 $parameters = $ref->getParameters();
302 if (count($parameters) !== 1) {
305 $reflectionClass = $parameters[0]->getClass();
306 if ($reflectionClass && $reflectionClass->getName() ==
'ilDBInterface') {
320 protected function hasWriteLocks()
322 $has_write_locks =
false;
326 foreach ($this->tables as
$table) {
328 $has_write_locks =
true;
332 return $has_write_locks;
342 $query($this->ilDBInstance);
357 if (count($this->tables) === 0) {
const DB_ATOM_CLOSURE_NONE
static $possible_anomalies
const ISOLATION_SERIALIZABLE
const ANO_NON_REPEATED_READ
static checkAnomaly($anomalie)
const DB_ATOM_LOCK_WRONG_LEVEL
const ISOLATION_READ_COMMITED
const ISOLATION_REPEATED_READ
static $available_isolations_levels
const DB_ATOM_CLOSURE_WRONG_FORMAT
addQueryCallable(callable $query)
All action on the database during this isolation has to be passed as Callable to ilAtomQuery.
Class ilAtomQueryException.
const DB_ATOM_CLOSURE_ALREADY_SET
const DB_ATOM_ISO_WRONG_LEVEL
const DB_ATOM_LOCK_NO_TABLE
const DB_ATOM_ANO_NOT_AVAILABLE
addTableLock($table_name)
Add table-names which are influenced by your queries, MyISAm has to lock those tables.
checkCallable(callable $query)
static getPossibleAnomalies($isolation_level)
const ISOLATION_READ_UNCOMMITED
static checkIsolationLevel($isolation_level)
if(empty($password)) $table
static isThereRiskThat($isolation_level, $anomaly)
replaceQueryCallable(callable $query)
__construct(ilDBInterface $ilDBInstance, $isolation_level=ilAtomQuery::ISOLATION_SERIALIZABLE)
ilAtomQuery constructor.