ILIAS
trunk Revision v11.0_alpha-1744-gb0451eebef4
|
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. More...
Public Member Functions | |
__construct (protected \ilDBInterface $ilDBInstance, int $isolation_level=ilAtomQuery::ISOLATION_SERIALIZABLE) | |
ilAtomQuery constructor. More... | |
getRisks () | |
addTableLock (string $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 (int $isolation_level, int $anomaly) |
static | getPossibleAnomalies (int $isolation_level) |
static | checkIsolationLevel (int $isolation_level) |
static | checkAnomaly (int $anomaly) |
Protected Member Functions | |
getDeterminedLockLevel () | |
checkQueries () | |
hasWriteLocks () | |
runQueries () | |
checkBeforeRun () | |
Protected Attributes | |
const | ITERATIONS = 10 |
int | $isolation_level = ilAtomQuery::ISOLATION_SERIALIZABLE |
array | $tables = [] |
$query | |
Static Protected Attributes | |
static array | $available_isolations_levels |
static array | $possible_anomalies |
static array | $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 27 of file class.ilAtomQueryBase.php.
ilAtomQueryBase::__construct | ( | protected \ilDBInterface | $ilDBInstance, |
int | $isolation_level = ilAtomQuery::ISOLATION_SERIALIZABLE |
||
) |
ilAtomQuery constructor.
int | $isolation_level | currently only ISOLATION_SERIALIZABLE is available |
Definition at line 81 of file class.ilAtomQueryBase.php.
References $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());
ilAtomQueryException |
Definition at line 133 of file class.ilAtomQueryBase.php.
References $query, checkCallable(), ilAtomQueryException\DB_ATOM_CLOSURE_ALREADY_SET, and ilAtomQueryException\DB_ATOM_CLOSURE_WRONG_FORMAT.
ilAtomQueryBase::addTableLock | ( | string | $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
Definition at line 104 of file class.ilAtomQueryBase.php.
References getDeterminedLockLevel().
|
static |
Definition at line 209 of file class.ilAtomQueryBase.php.
References ilAtomQueryException\DB_ATOM_ANO_NOT_AVAILABLE.
|
protected |
Definition at line 292 of file class.ilAtomQueryBase.php.
References checkQueries(), ilAtomQueryException\DB_ATOM_LOCK_NO_TABLE, ilAtomQueryException\DB_ATOM_LOCK_WRONG_LEVEL, getIsolationLevel(), and hasWriteLocks().
Referenced by ilAtomQueryTransaction\run(), and ilAtomQueryLock\run().
ilAtomQueryBase::checkCallable | ( | callable | $query | ) |
Definition at line 232 of file class.ilAtomQueryBase.php.
Referenced by addQueryCallable(), checkQueries(), and replaceQueryCallable().
|
static |
Definition at line 190 of file class.ilAtomQueryBase.php.
References ilAtomQueryException\DB_ATOM_ISO_WRONG_LEVEL, and ilAtomQuery\ISOLATION_READ_UNCOMMITED.
|
protected |
Definition at line 219 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 113 of file class.ilAtomQueryBase.php.
References ilAtomQuery\LOCK_WRITE.
Referenced by addTableLock().
ilAtomQueryBase::getIsolationLevel | ( | ) |
Definition at line 161 of file class.ilAtomQueryBase.php.
References $isolation_level.
Referenced by checkBeforeRun(), and getRisks().
|
static |
ilAtomQueryBase::getRisks | ( | ) |
Definition at line 93 of file class.ilAtomQueryBase.php.
References getIsolationLevel().
|
protected |
Definition at line 268 of file class.ilAtomQueryBase.php.
References ilAtomQuery\LOCK_WRITE.
Referenced by checkBeforeRun().
|
static |
ilAtomQueryBase::replaceQueryCallable | ( | callable | $query | ) |
Definition at line 147 of file class.ilAtomQueryBase.php.
References $query, checkCallable(), ilAtomQueryException\DB_ATOM_CLOSURE_WRONG_FORMAT, and run().
|
abstract |
Fire your Queries.
Referenced by replaceQueryCallable().
|
protected |
ilAtomQueryException |
Definition at line 283 of file class.ilAtomQueryBase.php.
References $query.
Referenced by ilAtomQueryLock\runWithLocks(), and ilAtomQueryTransaction\runWithTransactions().
|
staticprotected |
Definition at line 51 of file class.ilAtomQueryBase.php.
|
staticprotected |
Definition at line 33 of file class.ilAtomQueryBase.php.
|
protected |
Definition at line 67 of file class.ilAtomQueryBase.php.
Referenced by __construct(), getIsolationLevel(), and getPossibleAnomalies().
|
staticprotected |
Definition at line 42 of file class.ilAtomQueryBase.php.
|
protected |
Definition at line 75 of file class.ilAtomQueryBase.php.
Referenced by addQueryCallable(), checkQueries(), replaceQueryCallable(), and runQueries().
|
protected |
Definition at line 71 of file class.ilAtomQueryBase.php.
|
protected |
Definition at line 29 of file class.ilAtomQueryBase.php.