X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Flibs%2Frdbms%2Fdatabase%2FIDatabase.php;h=61788e1f483be7e5ed8256c4870ad218ae6ff350;hp=21451292bb1aac9f248eab055b84a21135f90927;hb=a075271157d32567e894c668aa2b76138c491b95;hpb=930a808814ac1dae6d851de1bef780b9142f9a51 diff --git a/includes/libs/rdbms/database/IDatabase.php b/includes/libs/rdbms/database/IDatabase.php index 21451292bb..61788e1f48 100644 --- a/includes/libs/rdbms/database/IDatabase.php +++ b/includes/libs/rdbms/database/IDatabase.php @@ -32,7 +32,7 @@ use stdClass; /** * Basic database interface for live and lazy-loaded relation database handles * - * @note: IDatabase and DBConnRef should be updated to reflect any changes + * @note IDatabase and DBConnRef should be updated to reflect any changes * @ingroup Database */ interface IDatabase { @@ -166,14 +166,14 @@ interface IDatabase { /** * Get/set the table prefix. - * @param string $prefix The table prefix to set, or omitted to leave it unchanged. + * @param string|null $prefix The table prefix to set, or omitted to leave it unchanged. * @return string The previous table prefix. */ public function tablePrefix( $prefix = null ); /** * Get/set the db schema. - * @param string $schema The database schema to set, or omitted to leave it unchanged. + * @param string|null $schema The database schema to set, or omitted to leave it unchanged. * @return string The previous db schema. */ public function dbSchema( $schema = null ); @@ -182,7 +182,7 @@ interface IDatabase { * Get properties passed down from the server info array of the load * balancer. * - * @param string $name The entry of the info array to get, or null to get the + * @param string|null $name The entry of the info array to get, or null to get the * whole array * * @return array|mixed|null @@ -195,7 +195,7 @@ interface IDatabase { * parameters, the member with the given name is set to the given value. * * @param string $name - * @param array $value + * @param array|null $value */ public function setLBInfo( $name, $value = null ); @@ -848,6 +848,21 @@ interface IDatabase { $tables, $var = '*', $conds = '', $fname = __METHOD__, $options = [], $join_conds = [] ); + /** + * Lock all rows meeting the given conditions/options FOR UPDATE + * + * @param array|string $table Table names + * @param array|string $conds Filters on the table + * @param string $fname Function name for profiling + * @param array $options Options for select ("FOR UPDATE" is added automatically) + * @param array $join_conds Join conditions + * @return int Number of matching rows found (and locked) + * @since 1.32 + */ + public function lockForUpdate( + $table, $conds = '', $fname = __METHOD__, $options = [], $join_conds = [] + ); + /** * Determines whether a field exists in a table * @@ -1485,7 +1500,7 @@ interface IDatabase { * * This is useful for combining cooperative locks and DB transactions. * - * @note: do not assume that *other* IDatabase instances will be AUTOCOMMIT mode + * @note do not assume that *other* IDatabase instances will be AUTOCOMMIT mode * * The callback takes the following arguments: * - How the transaction ended (IDatabase::TRIGGER_COMMIT or IDatabase::TRIGGER_ROLLBACK) @@ -1520,7 +1535,7 @@ interface IDatabase { * * Updates will execute in the order they were enqueued. * - * @note: do not assume that *other* IDatabase instances will be AUTOCOMMIT mode + * @note do not assume that *other* IDatabase instances will be AUTOCOMMIT mode * * The callback takes the following arguments: * - How the transaction ended (IDatabase::TRIGGER_COMMIT or IDatabase::TRIGGER_IDLE) @@ -1608,7 +1623,7 @@ interface IDatabase { * - The failures are from contention solvable via onTransactionPreCommitOrIdle() * - The failures are deadlocks; the RDBMs usually discard the whole transaction * - * @note: callers must use additional measures for situations involving two or more + * @note callers must use additional measures for situations involving two or more * (peer) transactions (e.g. updating two database servers at once). The transaction * and savepoint logic of this method only applies to this specific IDatabase instance. * @@ -1687,7 +1702,7 @@ interface IDatabase { * corresponding startAtomic() implicitly started a transaction, that * transaction is rolled back. * - * @note: callers must use additional measures for situations involving two or more + * @note callers must use additional measures for situations involving two or more * (peer) transactions (e.g. updating two database servers at once). The transaction * and savepoint logic of startAtomic() are bound to specific IDatabase instances. * @@ -1698,7 +1713,7 @@ interface IDatabase { * @since 1.31 * @see IDatabase::startAtomic * @param string $fname - * @param AtomicSectionIdentifier $sectionId Section ID from startAtomic(); + * @param AtomicSectionIdentifier|null $sectionId Section ID from startAtomic(); * passing this enables cancellation of unclosed nested sections [optional] * @throws DBError */ @@ -1882,7 +1897,7 @@ interface IDatabase { * The result is unquoted, and needs to be passed through addQuotes() * before it can be included in raw SQL. * - * @param string|int $ts + * @param string|int|null $ts * * @return string */