/**
* Get/set the table prefix.
* @param string|null $prefix The table prefix to set, or omitted to leave it unchanged.
- * @return string The previous table prefix.
+ * @return string The previous table prefix
+ * @throws DBUnexpectedError
*/
public function tablePrefix( $prefix = null );
/**
* Get/set the db schema.
* @param string|null $schema The database schema to set, or omitted to leave it unchanged.
- * @return string The previous db schema.
+ * @return string The previous db schema
*/
public function dbSchema( $schema = null );
public function getFlag( $flag );
/**
+ * Return the currently selected domain ID
+ *
+ * Null components (database/schema) might change once a connection is established
+ *
* @return string
*/
public function getDomainID();
* Execute a SELECT query constructed using the various parameters provided.
* See below for full details of the parameters.
*
- * @param string|array $table Table name
- * @param string|array $vars Field names
- * @param string|array $conds Conditions
- * @param string $fname Caller function name
- * @param array $options Query options
- * @param array $join_conds Join conditions
- *
- *
- * @param string|array $table
+ * @param string|array $table Table name(s)
*
* May be either an array of table names, or a single string holding a table
* name. If an array is given, table aliases can be specified, for example:
* Do not use untrusted user input as a table name. Alias names should
* not have characters outside of the Basic multilingual plane.
*
- * @param string|array $vars
+ * @param string|array $vars Field name(s)
*
* May be either a field name or an array of field names. The field names
* can be complete fragments of SQL, for direct inclusion into the SELECT
*
* Use an empty array, string, or '*' to update all rows.
*
- * @param string|array $options
+ * @param string $fname Caller function name
+ *
+ * @param string|array $options Query options
*
* Optional: Array of query options. Boolean options are specified by
* including them in the array as a string value with a numeric key, for
* - SQL_NO_CACHE
*
*
- * @param string|array $join_conds
+ * @param string|array $join_conds Join conditions
*
* Optional associative array of table-specific join conditions. In the
* most common case, this is unnecessary, since the join condition can be
* @param array $a Array of rows to insert
* @param string $fname Calling function name (use __METHOD__) for logs/profiling
* @param array $options Array of options
- *
- * @return bool
+ * @return bool Return true if no exception was thrown (deprecated since 1.33)
* @throws DBError
*/
public function insert( $table, $a, $fname = __METHOD__, $options = [] );
* @param array $options An array of UPDATE options, can be:
* - IGNORE: Ignore unique key conflicts
* - LOW_PRIORITY: MySQL-specific, see MySQL manual.
- * @return bool
+ * @return bool Return true if no exception was thrown (deprecated since 1.33)
* @throws DBError
*/
public function update( $table, $values, $conds, $fname = __METHOD__, $options = [] );
* Change the current database
*
* @param string $db
- * @return bool Success or failure
+ * @return bool True unless an exception was thrown
* @throws DBConnectionError If databasesAreIndependent() is true and an error occurs
+ * @throws DBError
+ * @deprecated Since 1.32
*/
public function selectDB( $db );
+ /**
+ * Set the current domain (database, schema, and table prefix)
+ *
+ * This will throw an error for some database types if the database unspecified
+ *
+ * @param string|DatabaseDomain $domain
+ * @since 1.32
+ * @throws DBConnectionError
+ */
+ public function selectDomain( $domain );
+
/**
* Get the current DB name
- * @return string
+ * @return string|null
*/
public function getDBname();
* things like "field = field + 1" or similar computed values.
* @param string $fname Calling function name (use __METHOD__) for logs/profiling
* @throws DBError
- * @return bool
+ * @return bool Return true if no exception was thrown (deprecated since 1.33)
*/
public function upsert(
$table, array $rows, array $uniqueIndexes, array $set, $fname = __METHOD__
* for the format. Use $conds == "*" to delete all rows
* @param string $fname Name of the calling function
* @throws DBUnexpectedError
- * @return bool|IResultWrapper
+ * @return bool Return true if no exception was thrown (deprecated since 1.33)
* @throws DBError
*/
public function delete( $table, $conds, $fname = __METHOD__ );
* @param array $selectJoinConds Join conditions for the SELECT part of the query, see
* IDatabase::select() for details.
*
- * @return bool
+ * @return bool Return true if no exception was thrown (deprecated since 1.33)
* @throws DBError
*/
public function insertSelect( $destTable, $srcTable, $varMap, $conds,
/**
* Wait for the replica DB to catch up to a given master position
*
+ * Note that this does not start any new transactions. If any existing transaction
+ * is flushed, and this is called, then queries will reflect the point the DB was synced
+ * up to (on success) without interference from REPEATABLE-READ snapshots.
+ *
* @param DBMasterPos $pos
* @param int $timeout The maximum number of seconds to wait for synchronisation
* @return int|null Zero if the replica DB was past that position already,