ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 56 of file class.ilAtomQueryLock.php.

57 {
58 $locks = array();
59 foreach ($this->tables as $table) {
60 $full_name = $table->getTableName() . $table->getAlias();
61 if (in_array($full_name, $this->locked_table_full_names)) {
63 }
64 $this->locked_table_full_names[] = $full_name;
65
66 if (!in_array($table->getTableName(), $this->locked_table_names)) {
67 $locks[] = array( 'name' => $table->getTableName(), 'type' => $table->getLockLevel() );
68 $this->locked_table_names[] = $table->getTableName();
69 if ($table->isLockSequence() && $this->ilDBInstance->sequenceExists($table->getTableName())) {
70 $locks[] = array( 'name' => $table->getTableName(), 'type' => $table->getLockLevel(), 'sequence' => true );
71 }
72 }
73 if ($table->getAlias()) {
74 $locks[] = array( 'name' => $table->getTableName(), 'type' => $table->getLockLevel(), 'alias' => $table->getAlias() );
75 }
76 }
77
78 return $locks;
79 }
Class ilAtomQueryException.
if(empty($password)) $table
Definition: pwgen.php:24

References $table, and 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 29 of file class.ilAtomQueryLock.php.

30 {
31 $this->checkBeforeRun();
32 $this->runWithLocks();
33 }

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

+ Here is the call graph for this function:

◆ runWithLocks()

ilAtomQueryLock::runWithLocks ( )
protected
Exceptions

ilAtomQueryException

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

40 {
41 $this->ilDBInstance->lockTables($this->getLocksForDBInstance());
42 try {
43 $this->runQueries();
44 } catch (Exception $e) {
45 $this->ilDBInstance->unlockTables();
46 throw $e;
47 }
48 $this->ilDBInstance->unlockTables();
49 }

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

◆ $locked_table_names

ilAtomQueryLock::$locked_table_names = array()
protected

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


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