ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilAtomQueryLock Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilAtomQueryLock:
+ Collaboration diagram for ilAtomQueryLock:

Public Member Functions

 run ()
 Fire your Queries. More...
 
- Public Member Functions inherited from ilAtomQueryBase
 __construct (ilDBInterface $ilDBInstance, int $isolation_level=ilAtomQuery::ISOLATION_SERIALIZABLE)
 ilAtomQuery constructor. More...
 
 getRisks ()
 
 addTableLock (string $table_name)
 Add table-names which are influenced by your queries, MyISAm has to lock those tables. More...
 
 addQueryCallable (callable $query)
 All action on the database during this isolation has to be passed as Callable to ilAtomQuery. More...
 
 replaceQueryCallable (callable $query)
 
 run ()
 Fire your Queries. More...
 
 getIsolationLevel ()
 
 checkCallable (callable $query)
 
- Public Member Functions inherited from ilAtomQuery
 addTableLock (string $table_name)
 Add table-names which are influenced by your queries, MyISAm has to lock those tables. More...
 
 addQueryCallable (callable $query)
 Every action on the database during this isolation has to be passed as Callable to ilAtomQuery. More...
 
 replaceQueryCallable (callable $query)
 Every action on the database during this isolation has to be passed as Callable to ilAtomQuery. More...
 
 getIsolationLevel ()
 Returns the current Isolation-Level. More...
 
 checkCallable (callable $query)
 Provides a check if your callable is ready to be used in ilAtomQuery. More...
 

Protected Member Functions

 runWithLocks ()
 
 getLocksForDBInstance ()
 
- Protected Member Functions inherited from ilAtomQueryBase
 getDeterminedLockLevel ()
 
 checkQueries ()
 
 hasWriteLocks ()
 
 runQueries ()
 
 checkBeforeRun ()
 

Protected Attributes

array $locked_table_full_names = []
 
array $locked_table_names = []
 
- Protected Attributes inherited from ilAtomQueryBase
const ITERATIONS = 10
 
int $isolation_level = ilAtomQuery::ISOLATION_SERIALIZABLE
 
array $tables = array()
 
 $query
 
ilDBInterface $ilDBInstance
 

Additional Inherited Members

- Static Public Member Functions inherited from ilAtomQueryBase
static isThereRiskThat (int $isolation_level, int $anomaly)
 
static getPossibleAnomalies (int $isolation_level)
 
static checkIsolationLevel (int $isolation_level)
 
static checkAnomaly (int $anomaly)
 
- Static Public Member Functions inherited from ilAtomQuery
static checkIsolationLevel (int $isolation_level)
 
- Data Fields inherited from ilAtomQuery
const LOCK_WRITE = 1
 
const LOCK_READ = 2
 
const ISOLATION_READ_UNCOMMITED = 1
 
const ISOLATION_READ_COMMITED = 2
 
const ISOLATION_REPEATED_READ = 3
 
const ISOLATION_SERIALIZABLE = 4
 
const ANO_LOST_UPDATES = 1
 
const ANO_DIRTY_READ = 2
 
const ANO_NON_REPEATED_READ = 3
 
const ANO_PHANTOM = 4
 
- Static Protected Attributes inherited from ilAtomQueryBase
static array $available_isolations_levels
 
static array $possible_anomalies
 
static array $anomalies_map
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilAtomQueryLock

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
    Implements Atom-Queries with Table Locks, currently used in all other implementations than Galera

Definition at line 28 of file class.ilAtomQueryLock.php.

Member Function Documentation

◆ getLocksForDBInstance()

ilAtomQueryLock::getLocksForDBInstance ( )
protected
Exceptions

Definition at line 72 of file class.ilAtomQueryLock.php.

References $locked_table_names, and ilAtomQueryException\DB_ATOM_IDENTICAL_TABLES.

Referenced by runWithLocks().

72  : array
73  {
74  $locks = array();
75  foreach ($this->tables as $table) {
76  $full_name = $table->getTableName() . $table->getAlias();
77  if (in_array($full_name, $this->locked_table_full_names, true)) {
79  }
80  $this->locked_table_full_names[] = $full_name;
81 
82  if (!in_array($table->getTableName(), $this->locked_table_names, true)) {
83  $locks[] = array( 'name' => $table->getTableName(), 'type' => $table->getLockLevel() );
84  $this->locked_table_names[] = $table->getTableName();
85  if ($table->isLockSequence() && $this->ilDBInstance->sequenceExists($table->getTableName())) {
86  $locks[] = array( 'name' => $table->getTableName(), 'type' => $table->getLockLevel(), 'sequence' => true );
87  }
88  }
89  if ($table->getAlias() !== '') {
90  $locks[] = array( 'name' => $table->getTableName(), 'type' => $table->getLockLevel(), 'alias' => $table->getAlias() );
91  }
92  }
93 
94  return $locks;
95  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ run()

ilAtomQueryLock::run ( )

Fire your Queries.

Exceptions

Implements ilAtomQuery.

Definition at line 45 of file class.ilAtomQueryLock.php.

References ilAtomQueryBase\checkBeforeRun(), and runWithLocks().

45  : void
46  {
47  $this->checkBeforeRun();
48  $this->runWithLocks();
49  }
+ Here is the call graph for this function:

◆ runWithLocks()

ilAtomQueryLock::runWithLocks ( )
protected
Exceptions

Definition at line 55 of file class.ilAtomQueryLock.php.

References Vendor\Package\$e, getLocksForDBInstance(), and ilAtomQueryBase\runQueries().

Referenced by run().

55  : void
56  {
57  $this->ilDBInstance->lockTables($this->getLocksForDBInstance());
58  try {
59  $this->runQueries();
60  } catch (Exception $e) {
61  $this->ilDBInstance->unlockTables();
62  throw $e;
63  }
64  $this->ilDBInstance->unlockTables();
65  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $locked_table_full_names

array ilAtomQueryLock::$locked_table_full_names = []
protected

Definition at line 33 of file class.ilAtomQueryLock.php.

◆ $locked_table_names

array ilAtomQueryLock::$locked_table_names = []
protected

Definition at line 37 of file class.ilAtomQueryLock.php.

Referenced by getLocksForDBInstance().


The documentation for this class was generated from the following file: