ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilAtomQueryLock Class Reference

Class ilAtomQueryLock. 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, $isolation_level=ilAtomQuery::ISOLATION_SERIALIZABLE)
 ilAtomQuery constructor. More...
 
 getRisks ()
 
 addTableLock ($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)
 

Protected Member Functions

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

Protected Attributes

 $locked_table_full_names = array()
 
 $locked_table_names = array()
 
- Protected Attributes inherited from ilAtomQueryBase
 $isolation_level = ilAtomQuery::ISOLATION_SERIALIZABLE
 
 $tables = array()
 
 $query = null
 
 $ilDBInstance
 

Additional Inherited Members

- Static Public Member Functions inherited from ilAtomQueryBase
static isThereRiskThat ($isolation_level, $anomaly)
 
static getPossibleAnomalies ($isolation_level)
 
static checkIsolationLevel ($isolation_level)
 
static checkAnomaly ($anomalie)
 
- Data Fields inherited from ilAtomQueryBase
const ITERATIONS = 10
 
- 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 $available_isolations_levels
 
static $possible_anomalies
 
static $anomalies_map
 

Detailed Description

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 11 of file class.ilAtomQueryLock.php.

Member Function Documentation

◆ getLocksForDBInstance()

ilAtomQueryLock::getLocksForDBInstance ( )
protected
Returns
array
Exceptions

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

References $locked_table_names, array, and ilAtomQueryException\DB_ATOM_IDENTICAL_TABLES.

Referenced by runWithLocks().

53  {
54  $locks = array();
55  foreach ($this->tables as $table) {
56  $full_name = $table->getTableName() . $table->getAlias();
57  if (in_array($full_name, $this->locked_table_full_names)) {
59  }
60  $this->locked_table_full_names[] = $full_name;
61 
62  if (!in_array($table->getTableName(), $this->locked_table_names)) {
63  $locks[] = array( 'name' => $table->getTableName(), 'type' => $table->getLockLevel() );
64  $this->locked_table_names[] = $table->getTableName();
65  if ($table->isLockSequence() && $this->ilDBInstance->sequenceExists($table->getTableName())) {
66  $locks[] = array( 'name' => $table->getTableName(), 'type' => $table->getLockLevel(), 'sequence' => true );
67  }
68  }
69  if ($table->getAlias()) {
70  $locks[] = array( 'name' => $table->getTableName(), 'type' => $table->getLockLevel(), 'alias' => $table->getAlias() );
71  }
72  }
73 
74  return $locks;
75  }
Class ilAtomQueryException.
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ run()

ilAtomQueryLock::run ( )

Fire your Queries.

Exceptions

Implements ilAtomQuery.

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

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

28  {
29  $this->checkBeforeRun();
30  $this->runWithLocks();
31  }
+ Here is the call graph for this function:

◆ runWithLocks()

ilAtomQueryLock::runWithLocks ( )
protected
Exceptions

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

References getLocksForDBInstance(), and ilAtomQueryBase\runQueries().

Referenced by run().

37  {
38  $this->ilDBInstance->lockTables($this->getLocksForDBInstance());
39  try {
40  $this->runQueries();
41  } catch (Exception $e) {
42  $this->ilDBInstance->unlockTables();
43  throw $e;
44  }
45  $this->ilDBInstance->unlockTables();
46  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $locked_table_full_names

ilAtomQueryLock::$locked_table_full_names = array()
protected

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

◆ $locked_table_names

ilAtomQueryLock::$locked_table_names = array()
protected

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

Referenced by getLocksForDBInstance().


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