/**
* 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 {
/**
* 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 );
* 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
* 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 );
$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
*
*
* 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)
*
* 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)
* - 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.
*
* 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.
*
* @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
*/
* 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
*/
public function setIndexAliases( array $aliases );
}
+/**
+ * @deprecated since 1.29
+ */
class_alias( IDatabase::class, 'IDatabase' );