ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilAtomQueryLock.php
Go to the documentation of this file.
1 <?php
2 require_once('./Services/Database/interfaces/interface.ilAtomQuery.php');
3 
12 {
13 
17  protected $locked_table_full_names = array();
21  protected $locked_table_names = array();
22 
23 
29  public function run()
30  {
31  $this->checkBeforeRun();
32  $this->runWithLocks();
33  }
34 
35 
39  protected function runWithLocks()
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  }
50 
51 
56  protected function getLocksForDBInstance()
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  }
80 }
Class ilAtomQuery.
run()
Fire your Queries.
Class ilAtomQueryLock.
Class ilAtomQueryException.
Interface ilAtomQuery.
if(empty($password)) $table
Definition: pwgen.php:24