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)
 
 addTableLock ($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...
 
 run ()
 Fire your Queries. 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 ()
 
 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)
 
static checkIsolationLevel ($isolation_level)
 
- 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

ilAtomQueryException

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

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.

References ilAtomQueryException\DB_ATOM_IDENTICAL_TABLES.

Referenced by runWithLocks().

+ Here is the caller graph for this function:

◆ run()

ilAtomQueryLock::run ( )

Fire your Queries.

Exceptions

ilAtomQueryException

Reimplemented from ilAtomQueryBase.

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

28 {
29 $this->checkBeforeRun();
30 $this->runWithLocks();
31 }

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

+ Here is the call graph for this function:

◆ runWithLocks()

ilAtomQueryLock::runWithLocks ( )
protected
Exceptions

ilAtomQueryException

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

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 }

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

Referenced by run().

+ 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.


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