2015-04-24 17:00:22 +00:00
|
|
|
<?php
|
2017-02-06 22:32:49 +00:00
|
|
|
|
2017-03-29 16:15:50 +00:00
|
|
|
namespace Wikimedia\Rdbms;
|
|
|
|
|
|
|
|
|
|
use InvalidArgumentException;
|
2017-02-06 22:32:49 +00:00
|
|
|
|
2015-04-24 17:00:22 +00:00
|
|
|
/**
|
|
|
|
|
* Helper class to handle automatically marking connections as reusable (via RAII pattern)
|
|
|
|
|
* as well handling deferring the actual network connection until the handle is used
|
|
|
|
|
*
|
2017-05-04 08:20:43 +00:00
|
|
|
* @note: proxy methods are defined explicitly to avoid interface errors
|
2015-04-24 17:00:22 +00:00
|
|
|
* @ingroup Database
|
|
|
|
|
* @since 1.22
|
|
|
|
|
*/
|
|
|
|
|
class DBConnRef implements IDatabase {
|
2016-09-14 09:21:18 +00:00
|
|
|
/** @var ILoadBalancer */
|
2015-04-24 17:00:22 +00:00
|
|
|
private $lb;
|
2016-11-28 18:26:14 +00:00
|
|
|
/** @var Database|null Live connection handle */
|
2015-04-24 17:00:22 +00:00
|
|
|
private $conn;
|
2016-09-17 04:39:57 +00:00
|
|
|
/** @var array|null N-tuple of (server index, group, DatabaseDomain|string) */
|
2015-04-24 17:00:22 +00:00
|
|
|
private $params;
|
|
|
|
|
|
2016-09-11 21:57:09 +00:00
|
|
|
const FLD_INDEX = 0;
|
|
|
|
|
const FLD_GROUP = 1;
|
2016-09-17 04:39:57 +00:00
|
|
|
const FLD_DOMAIN = 2;
|
2016-09-11 21:57:09 +00:00
|
|
|
|
2015-04-24 17:00:22 +00:00
|
|
|
/**
|
2016-11-28 18:26:14 +00:00
|
|
|
* @param ILoadBalancer $lb Connection manager for $conn
|
|
|
|
|
* @param Database|array $conn New connection handle or (server index, query groups, domain)
|
2015-04-24 17:00:22 +00:00
|
|
|
*/
|
2016-09-14 09:21:18 +00:00
|
|
|
public function __construct( ILoadBalancer $lb, $conn ) {
|
2015-04-24 17:00:22 +00:00
|
|
|
$this->lb = $lb;
|
2016-11-28 18:26:14 +00:00
|
|
|
if ( $conn instanceof Database ) {
|
2016-09-14 09:21:18 +00:00
|
|
|
$this->conn = $conn; // live handle
|
2016-09-17 04:39:57 +00:00
|
|
|
} elseif ( count( $conn ) >= 3 && $conn[self::FLD_DOMAIN] !== false ) {
|
2015-04-24 17:00:22 +00:00
|
|
|
$this->params = $conn;
|
2016-09-11 21:57:09 +00:00
|
|
|
} else {
|
|
|
|
|
throw new InvalidArgumentException( "Missing lazy connection arguments." );
|
2015-04-24 17:00:22 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-01 20:23:54 +00:00
|
|
|
function __call( $name, array $arguments ) {
|
2015-04-24 17:00:22 +00:00
|
|
|
if ( $this->conn === null ) {
|
|
|
|
|
list( $db, $groups, $wiki ) = $this->params;
|
|
|
|
|
$this->conn = $this->lb->getConnection( $db, $groups, $wiki );
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
return call_user_func_array( [ $this->conn, $name ], $arguments );
|
2015-04-24 17:00:22 +00:00
|
|
|
}
|
|
|
|
|
|
2015-07-01 20:23:54 +00:00
|
|
|
public function getServerInfo() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function bufferResults( $buffer = null ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function trxLevel() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function trxTimestamp() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
2016-08-19 20:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function explicitTrxActive() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
2015-07-01 20:23:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function tablePrefix( $prefix = null ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function dbSchema( $schema = null ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getLBInfo( $name = null ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function setLBInfo( $name, $value = null ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-15 02:04:21 +00:00
|
|
|
public function setLazyMasterHandle( IDatabase $conn ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-01 20:23:54 +00:00
|
|
|
public function implicitGroupby() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function implicitOrderby() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function lastQuery() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function doneWrites() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function lastDoneWrites() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-21 05:55:51 +00:00
|
|
|
public function writesPending() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-01 20:23:54 +00:00
|
|
|
public function writesOrCallbacksPending() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-27 10:57:26 +00:00
|
|
|
public function pendingWriteQueryDuration( $type = self::ESTIMATE_TOTAL ) {
|
2015-07-01 20:23:54 +00:00
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-06 02:19:40 +00:00
|
|
|
public function pendingWriteCallers() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-26 18:42:05 +00:00
|
|
|
public function pendingWriteRowsAffected() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-01 20:23:54 +00:00
|
|
|
public function isOpen() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-22 05:35:12 +00:00
|
|
|
public function setFlag( $flag, $remember = self::REMEMBER_NOTHING ) {
|
2015-07-01 20:23:54 +00:00
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-22 05:35:12 +00:00
|
|
|
public function clearFlag( $flag, $remember = self::REMEMBER_NOTHING ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function restoreFlags( $state = self::RESTORE_PRIOR ) {
|
2015-07-01 20:23:54 +00:00
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getFlag( $flag ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getProperty( $name ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-16 03:14:58 +00:00
|
|
|
public function getDomainID() {
|
2016-09-11 21:57:09 +00:00
|
|
|
if ( $this->conn === null ) {
|
2016-09-17 04:39:57 +00:00
|
|
|
$domain = $this->params[self::FLD_DOMAIN];
|
|
|
|
|
// Avoid triggering a database connection
|
|
|
|
|
return $domain instanceof DatabaseDomain ? $domain->getId() : $domain;
|
2016-09-11 21:57:09 +00:00
|
|
|
}
|
|
|
|
|
|
2015-07-01 20:23:54 +00:00
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-16 03:14:58 +00:00
|
|
|
public function getWikiID() {
|
|
|
|
|
return $this->getDomainID();
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-01 20:23:54 +00:00
|
|
|
public function getType() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function open( $server, $user, $password, $dbName ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function fetchObject( $res ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function fetchRow( $res ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function numRows( $res ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function numFields( $res ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function fieldName( $res, $n ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function insertId() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function dataSeek( $res, $row ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function lastErrno() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function lastError() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function fieldInfo( $table, $field ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function affectedRows() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getSoftwareLink() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getServerVersion() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function close() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function reportConnectionError( $error = 'Unknown error' ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function query( $sql, $fname = __METHOD__, $tempIgnore = false ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function reportQueryError( $error, $errno, $sql, $fname, $tempIgnore = false ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function freeResult( $res ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function selectField(
|
2017-06-09 16:58:09 +00:00
|
|
|
$table, $var, $cond = '', $fname = __METHOD__, $options = [], $join_conds = []
|
2015-07-01 20:23:54 +00:00
|
|
|
) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function selectFieldValues(
|
2017-06-09 16:58:09 +00:00
|
|
|
$table, $var, $cond = '', $fname = __METHOD__, $options = [], $join_conds = []
|
2015-07-01 20:23:54 +00:00
|
|
|
) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function select(
|
|
|
|
|
$table, $vars, $conds = '', $fname = __METHOD__,
|
2016-02-17 09:09:32 +00:00
|
|
|
$options = [], $join_conds = []
|
2015-07-01 20:23:54 +00:00
|
|
|
) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function selectSQLText(
|
|
|
|
|
$table, $vars, $conds = '', $fname = __METHOD__,
|
2016-02-17 09:09:32 +00:00
|
|
|
$options = [], $join_conds = []
|
2015-07-01 20:23:54 +00:00
|
|
|
) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function selectRow(
|
|
|
|
|
$table, $vars, $conds, $fname = __METHOD__,
|
2016-02-17 09:09:32 +00:00
|
|
|
$options = [], $join_conds = []
|
2015-07-01 20:23:54 +00:00
|
|
|
) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function estimateRowCount(
|
2016-02-17 09:09:32 +00:00
|
|
|
$table, $vars = '*', $conds = '', $fname = __METHOD__, $options = []
|
2015-07-01 20:23:54 +00:00
|
|
|
) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function selectRowCount(
|
2016-02-17 09:09:32 +00:00
|
|
|
$tables, $vars = '*', $conds = '', $fname = __METHOD__, $options = [], $join_conds = []
|
2015-07-01 20:23:54 +00:00
|
|
|
) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function fieldExists( $table, $field, $fname = __METHOD__ ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function indexExists( $table, $index, $fname = __METHOD__ ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function tableExists( $table, $fname = __METHOD__ ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function indexUnique( $table, $index ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
public function insert( $table, $a, $fname = __METHOD__, $options = [] ) {
|
2015-07-01 20:23:54 +00:00
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
public function update( $table, $values, $conds, $fname = __METHOD__, $options = [] ) {
|
2015-07-01 20:23:54 +00:00
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-19 07:28:17 +00:00
|
|
|
public function makeList( $a, $mode = self::LIST_COMMA ) {
|
2015-07-01 20:23:54 +00:00
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function makeWhereFrom2d( $data, $baseKey, $subKey ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-21 19:25:08 +00:00
|
|
|
public function aggregateValue( $valuedata, $valuename = 'value' ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-01 20:23:54 +00:00
|
|
|
public function bitNot( $field ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function bitAnd( $fieldLeft, $fieldRight ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function bitOr( $fieldLeft, $fieldRight ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function buildConcat( $stringList ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function buildGroupConcatField(
|
2016-02-17 09:09:32 +00:00
|
|
|
$delim, $table, $field, $conds = '', $join_conds = []
|
2015-07-01 20:23:54 +00:00
|
|
|
) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-21 19:25:08 +00:00
|
|
|
public function buildStringCast( $field ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-10 01:27:28 +00:00
|
|
|
public function databasesAreIndependent() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-01 20:23:54 +00:00
|
|
|
public function selectDB( $db ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getDBname() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getServer() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function addQuotes( $s ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function buildLike() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function anyChar() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function anyString() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function nextSequenceValue( $seqName ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function replace( $table, $uniqueIndexes, $rows, $fname = __METHOD__ ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function upsert(
|
|
|
|
|
$table, array $rows, array $uniqueIndexes, array $set, $fname = __METHOD__
|
|
|
|
|
) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function deleteJoin(
|
|
|
|
|
$delTable, $joinTable, $delVar, $joinVar, $conds, $fname = __METHOD__
|
|
|
|
|
) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function delete( $table, $conds, $fname = __METHOD__ ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function insertSelect(
|
|
|
|
|
$destTable, $srcTable, $varMap, $conds,
|
2017-06-09 16:58:09 +00:00
|
|
|
$fname = __METHOD__, $insertOptions = [], $selectOptions = [], $selectJoinConds = []
|
2015-07-01 20:23:54 +00:00
|
|
|
) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function unionSupportsOrderAndLimit() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function unionQueries( $sqls, $all ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function conditional( $cond, $trueVal, $falseVal ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function strreplace( $orig, $old, $new ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getServerUptime() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function wasDeadlock() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function wasLockTimeout() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function wasErrorReissuable() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function wasReadOnlyError() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function masterPosWait( DBMasterPos $pos, $timeout ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-24 04:17:32 +00:00
|
|
|
public function getReplicaPos() {
|
2015-07-01 20:23:54 +00:00
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getMasterPos() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-22 05:15:30 +00:00
|
|
|
public function serverIsReadOnly() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-15 21:40:00 +00:00
|
|
|
public function onTransactionResolution( callable $callback, $fname = __METHOD__ ) {
|
2015-07-01 20:23:54 +00:00
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-15 21:40:00 +00:00
|
|
|
public function onTransactionIdle( callable $callback, $fname = __METHOD__ ) {
|
2016-07-04 18:02:42 +00:00
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-15 21:40:00 +00:00
|
|
|
public function onTransactionPreCommitOrIdle( callable $callback, $fname = __METHOD__ ) {
|
2015-07-01 20:23:54 +00:00
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-26 07:19:34 +00:00
|
|
|
public function setTransactionListener( $name, callable $callback = null ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-01 20:23:54 +00:00
|
|
|
public function startAtomic( $fname = __METHOD__ ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function endAtomic( $fname = __METHOD__ ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-07 23:39:06 +00:00
|
|
|
public function doAtomicSection( $fname, callable $callback ) {
|
2015-12-23 02:18:59 +00:00
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-14 04:26:12 +00:00
|
|
|
public function begin( $fname = __METHOD__, $mode = IDatabase::TRANSACTION_EXPLICIT ) {
|
2015-07-01 20:23:54 +00:00
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function commit( $fname = __METHOD__, $flush = '' ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function rollback( $fname = __METHOD__, $flush = '' ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-08 11:28:52 +00:00
|
|
|
public function flushSnapshot( $fname = __METHOD__ ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-01 20:23:54 +00:00
|
|
|
public function listTables( $prefix = null, $fname = __METHOD__ ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function timestamp( $ts = 0 ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function timestampOrNull( $ts = null ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-27 10:57:26 +00:00
|
|
|
public function ping( &$rtt = null ) {
|
|
|
|
|
return func_num_args()
|
|
|
|
|
? $this->__call( __FUNCTION__, [ &$rtt ] )
|
|
|
|
|
: $this->__call( __FUNCTION__, [] ); // method cares about null vs missing
|
2015-07-01 20:23:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getLag() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-01 02:40:09 +00:00
|
|
|
public function getSessionLagStatus() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-01 20:23:54 +00:00
|
|
|
public function maxListLen() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function encodeBlob( $b ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function decodeBlob( $b ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function setSessionOptions( array $options ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function setSchemaVars( $vars ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function lockIsFree( $lockName, $method ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function lock( $lockName, $method, $timeout = 5 ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function unlock( $lockName, $method ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-17 10:40:53 +00:00
|
|
|
public function getScopedLockAndFlush( $lockKey, $fname, $timeout ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-01 20:23:54 +00:00
|
|
|
public function namedLocksEnqueue() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getInfinity() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function encodeExpiry( $expiry ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function decodeExpiry( $expiry, $format = TS_MW ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function setBigSelects( $value = true ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-20 23:42:02 +00:00
|
|
|
public function isReadOnly() {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-15 17:07:47 +00:00
|
|
|
public function setTableAliases( array $aliases ) {
|
|
|
|
|
return $this->__call( __FUNCTION__, func_get_args() );
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-01 20:23:54 +00:00
|
|
|
/**
|
|
|
|
|
* Clean up the connection when out of scope
|
|
|
|
|
*/
|
|
|
|
|
function __destruct() {
|
2016-11-28 18:26:14 +00:00
|
|
|
if ( $this->conn ) {
|
2015-04-24 17:00:22 +00:00
|
|
|
$this->lb->reuseConnection( $this->conn );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-03-29 16:15:50 +00:00
|
|
|
|
2017-02-07 04:49:57 +00:00
|
|
|
class_alias( DBConnRef::class, 'DBConnRef' );
|