ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
|
Class ilAtomQuery. More...
Public Member Functions | |
__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) | |
Static Public Member Functions | |
static | isThereRiskThat ($isolation_level, $anomaly) |
static | getPossibleAnomalies ($isolation_level) |
static | checkIsolationLevel ($isolation_level) |
static | checkAnomaly ($anomalie) |
Data Fields | |
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 |
Protected Member Functions | |
getDeterminedLockLevel () | |
checkQueries () | |
runQueries () | |
checkBeforeRun () | |
Protected Attributes | |
$isolation_level = ilAtomQuery::ISOLATION_SERIALIZABLE | |
$tables = array() | |
$query = null | |
$ilDBInstance | |
Static Protected Attributes | |
static | $available_isolations_levels |
static | $possible_anomalies |
static | $anomalies_map |
Class ilAtomQuery.
Use ilAtomQuery to fire Database-Actions which have to be done without beeing influenced by other queries or which can influence other queries as well. Depending on the current Database-engine, this can be done by using transaction or with table-locks
Definition at line 13 of file class.ilAtomQueryBase.php.
ilAtomQueryBase::__construct | ( | ilDBInterface | $ilDBInstance, |
$isolation_level = ilAtomQuery::ISOLATION_SERIALIZABLE |
|||
) |
ilAtomQuery constructor.
\ilDBInterface | $ilDBInstance | |
int | $isolation_level | currently only ISOLATION_SERIALIZABLE is available |
Definition at line 77 of file class.ilAtomQueryBase.php.
References $ilDBInstance, and $isolation_level.
ilAtomQueryBase::addQueryCallable | ( | callable | $query | ) |
All action on the database during this isolation has to be passed as Callable to ilAtomQuery.
An example (Closure): $ilAtomQuery->addQueryClosure( function (ilDBInterface $ilDB) use ($new_obj_id, $current_id) { $ilDB->doStuff(); });
An example (Callable Class): class ilMyAtomQueryClass { public function __invoke(ilDBInterface $ilDB) { $ilDB->doStuff(); } }
$ilAtomQuery->addQueryClosure(new ilMyAtomQueryClass());
\callable | $query |
ilAtomQueryException |
Implements ilAtomQuery.
Definition at line 152 of file class.ilAtomQueryBase.php.
References $query, checkCallable(), ilAtomQueryException\DB_ATOM_CLOSURE_ALREADY_SET, and ilAtomQueryException\DB_ATOM_CLOSURE_WRONG_FORMAT.
ilAtomQueryBase::addTableLock | ( | $table_name | ) |
Add table-names which are influenced by your queries, MyISAm has to lock those tables.
You get an ilTableLockInterface with further possibilities, e.g.:
$ilAtomQuery->addTableLock('my_table')->lockSequence(true)->aliasName('my_alias');
the lock-level is determined by ilAtomQuery
$table_name |
Implements ilAtomQuery.
Definition at line 107 of file class.ilAtomQueryBase.php.
References getDeterminedLockLevel().
|
static |
$anomalie |
Definition at line 247 of file class.ilAtomQueryBase.php.
References ilAtomQueryException\DB_ATOM_ANO_NOT_AVAILABLE.
Referenced by ilDatabaseAtomBaseTest\testAnomalies().
|
protected |
Definition at line 349 of file class.ilAtomQueryBase.php.
References checkQueries(), ilAtomQueryException\DB_ATOM_LOCK_NO_TABLE, ilAtomQueryException\DB_ATOM_LOCK_WRONG_LEVEL, getIsolationLevel(), and ilAtomQuery\ISOLATION_SERIALIZABLE.
Referenced by ilAtomQueryTransaction\run(), and ilAtomQueryLock\run().
ilAtomQueryBase::checkCallable | ( | callable | $query | ) |
callable | $query |
Implements ilAtomQuery.
Definition at line 276 of file class.ilAtomQueryBase.php.
References $table, and ilAtomQuery\LOCK_WRITE.
Referenced by addQueryCallable(), checkQueries(), and replaceQueryCallable().
|
static |
$isolation_level |
Implements ilAtomQuery.
Definition at line 226 of file class.ilAtomQueryBase.php.
References $isolation_level, ilAtomQueryException\DB_ATOM_ISO_WRONG_LEVEL, ilAtomQuery\ISOLATION_READ_COMMITED, ilAtomQuery\ISOLATION_READ_UNCOMMITED, and ilAtomQuery\ISOLATION_REPEATED_READ.
Referenced by ilDatabaseAtomBaseTest\testLevel().
|
protected |
Definition at line 258 of file class.ilAtomQueryBase.php.
References $query, checkCallable(), ilAtomQueryException\DB_ATOM_CLOSURE_NONE, and ilAtomQueryException\DB_ATOM_CLOSURE_WRONG_FORMAT.
Referenced by checkBeforeRun().
|
protected |
Definition at line 120 of file class.ilAtomQueryBase.php.
References getIsolationLevel(), ilAtomQuery\ISOLATION_SERIALIZABLE, and ilAtomQuery\LOCK_WRITE.
Referenced by addTableLock().
ilAtomQueryBase::getIsolationLevel | ( | ) |
Implements ilAtomQuery.
Definition at line 189 of file class.ilAtomQueryBase.php.
References $isolation_level.
Referenced by checkBeforeRun(), getDeterminedLockLevel(), and getRisks().
|
static |
$isolation_level |
Definition at line 214 of file class.ilAtomQueryBase.php.
References $isolation_level.
ilAtomQueryBase::getRisks | ( | ) |
Definition at line 90 of file class.ilAtomQueryBase.php.
References getIsolationLevel().
|
static |
$isolation_level | |
$anomaly |
Definition at line 201 of file class.ilAtomQueryBase.php.
References $isolation_level.
ilAtomQueryBase::replaceQueryCallable | ( | callable | $query | ) |
callable | $query |
Implements ilAtomQuery.
Definition at line 168 of file class.ilAtomQueryBase.php.
References $query, checkCallable(), ilAtomQueryException\DB_ATOM_CLOSURE_WRONG_FORMAT, and run().
|
abstract |
Fire your Queries.
Implements ilAtomQuery.
Referenced by replaceQueryCallable().
|
protected |
ilAtomQueryException |
Definition at line 339 of file class.ilAtomQueryBase.php.
References $query.
Referenced by ilAtomQueryLock\runWithLocks(), and ilAtomQueryTransaction\runWithTransactions().
|
staticprotected |
Definition at line 37 of file class.ilAtomQueryBase.php.
|
staticprotected |
Definition at line 19 of file class.ilAtomQueryBase.php.
|
protected |
Definition at line 68 of file class.ilAtomQueryBase.php.
Referenced by __construct().
|
protected |
Definition at line 56 of file class.ilAtomQueryBase.php.
Referenced by __construct(), checkIsolationLevel(), getIsolationLevel(), getPossibleAnomalies(), and isThereRiskThat().
|
staticprotected |
Definition at line 28 of file class.ilAtomQueryBase.php.
|
protected |
Definition at line 64 of file class.ilAtomQueryBase.php.
Referenced by addQueryCallable(), checkQueries(), replaceQueryCallable(), and runQueries().
|
protected |
Definition at line 60 of file class.ilAtomQueryBase.php.
const ilAtomQueryBase::ITERATIONS = 10 |
Definition at line 15 of file class.ilAtomQueryBase.php.