*/
private $mTrxWriteDuration = 0.0;
+ /** @var IDatabase|null Lazy handle to the master DB this server replicates from */
+ private $lazyMasterHandle;
+
/**
* @since 1.21
* @var resource File handle for upgrade
}
}
+ /**
+ * Set a lazy-connecting DB handle to the master DB (for replication status purposes)
+ *
+ * @param IDatabase $conn
+ * @since 1.27
+ */
+ public function setLazyMasterHandle( IDatabase $conn ) {
+ $this->lazyMasterHandle = $conn;
+ }
+
+ /**
+ * @return IDatabase|null
+ * @see setLazyMasterHandle()
+ * @since 1.27
+ */
+ public function getLazyMasterHandle() {
+ return $this->lazyMasterHandle;
+ }
+
/**
* @return TransactionProfiler
*/
* @param string|array $cond The condition array. See DatabaseBase::select() for details.
* @param string $fname The function name of the caller.
* @param string|array $options The query options. See DatabaseBase::select() for details.
+ * @param string|array $join_conds The join conditions. See DatabaseBase::select() for details.
*
* @return bool|array The values from the field, or false on failure
* @throws DBUnexpectedError
* @since 1.25
*/
public function selectFieldValues(
- $table, $var, $cond = '', $fname = __METHOD__, $options = array()
+ $table, $var, $cond = '', $fname = __METHOD__, $options = array(), $join_conds = array()
) {
if ( $var === '*' ) { // sanity
throw new DBUnexpectedError( $this, "Cannot use a * field: got '$var'" );
$options = array( $options );
}
- $res = $this->select( $table, $var, $cond, $fname, $options );
+ $res = $this->select( $table, $var, $cond, $fname, $options, $join_conds );
if ( $res === false ) {
return false;
}
}
}
+ final public function doAtomicSection( $fname, $callback ) {
+ if ( !is_callable( $callback ) ) {
+ throw new UnexpectedValueException( "Invalid callback." );
+ };
+
+ $this->startAtomic( $fname );
+ try {
+ call_user_func_array( $callback, array( $this, $fname ) );
+ } catch ( Exception $e ) {
+ $this->rollback( $fname );
+ throw $e;
+ }
+ $this->endAtomic( $fname );
+ }
+
/**
* Begin a transaction. If a transaction is already in progress,
* that transaction will be committed before the new transaction is started.