X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Flibs%2Frdbms%2Fdatabase%2FDBConnRef.php;h=f26b98546b29129206af1aba546651da9966563d;hp=eb0e954e169ac93541a45a0be94ed785b27b7c89;hb=14d08d1df93a9e2d98d505769be94c96b348f8c5;hpb=4427b84407e03275bdb62ca58a0fde14f3dc7be6 diff --git a/includes/libs/rdbms/database/DBConnRef.php b/includes/libs/rdbms/database/DBConnRef.php index eb0e954e16..decd9bfa4b 100644 --- a/includes/libs/rdbms/database/DBConnRef.php +++ b/includes/libs/rdbms/database/DBConnRef.php @@ -23,16 +23,17 @@ class DBConnRef implements IDatabase { const FLD_INDEX = 0; const FLD_GROUP = 1; const FLD_DOMAIN = 2; + const FLD_FLAGS = 3; /** * @param ILoadBalancer $lb Connection manager for $conn - * @param Database|array $conn New connection handle or (server index, query groups, domain) + * @param Database|array $conn Database handle or (server index, query groups, domain, flags) */ public function __construct( ILoadBalancer $lb, $conn ) { $this->lb = $lb; if ( $conn instanceof Database ) { $this->conn = $conn; // live handle - } elseif ( count( $conn ) >= 3 && $conn[self::FLD_DOMAIN] !== false ) { + } elseif ( is_array( $conn ) && count( $conn ) >= 4 && $conn[self::FLD_DOMAIN] !== false ) { $this->params = $conn; } else { throw new InvalidArgumentException( "Missing lazy connection arguments." ); @@ -41,8 +42,8 @@ class DBConnRef implements IDatabase { function __call( $name, array $arguments ) { if ( $this->conn === null ) { - list( $db, $groups, $wiki ) = $this->params; - $this->conn = $this->lb->getConnection( $db, $groups, $wiki ); + list( $db, $groups, $wiki, $flags ) = $this->params; + $this->conn = $this->lb->getConnection( $db, $groups, $wiki, $flags ); } return call_user_func_array( [ $this->conn, $name ], $arguments ); @@ -210,10 +211,6 @@ class DBConnRef implements IDatabase { 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() ); } @@ -230,18 +227,10 @@ class DBConnRef implements IDatabase { 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() ); } @@ -280,7 +269,7 @@ class DBConnRef implements IDatabase { } public function estimateRowCount( - $table, $vars = '*', $conds = '', $fname = __METHOD__, $options = [] + $table, $vars = '*', $conds = '', $fname = __METHOD__, $options = [], $join_conds = [] ) { return $this->__call( __FUNCTION__, func_get_args() ); } @@ -303,10 +292,6 @@ class DBConnRef implements IDatabase { return $this->__call( __FUNCTION__, func_get_args() ); } - public function indexUnique( $table, $index ) { - return $this->__call( __FUNCTION__, func_get_args() ); - } - public function insert( $table, $a, $fname = __METHOD__, $options = [] ) { return $this->__call( __FUNCTION__, func_get_args() ); } @@ -349,10 +334,25 @@ class DBConnRef implements IDatabase { return $this->__call( __FUNCTION__, func_get_args() ); } + public function buildSubstring( $input, $startPosition, $length = null ) { + return $this->__call( __FUNCTION__, func_get_args() ); + } + public function buildStringCast( $field ) { return $this->__call( __FUNCTION__, func_get_args() ); } + public function buildIntegerCast( $field ) { + return $this->__call( __FUNCTION__, func_get_args() ); + } + + public function buildSelectSubquery( + $table, $vars, $conds = '', $fname = __METHOD__, + $options = [], $join_conds = [] + ) { + return $this->__call( __FUNCTION__, func_get_args() ); + } + public function databasesAreIndependent() { return $this->__call( __FUNCTION__, func_get_args() ); } @@ -451,7 +451,7 @@ class DBConnRef implements IDatabase { return $this->__call( __FUNCTION__, func_get_args() ); } - public function wasErrorReissuable() { + public function wasConnectionLoss() { return $this->__call( __FUNCTION__, func_get_args() ); } @@ -459,6 +459,10 @@ class DBConnRef implements IDatabase { return $this->__call( __FUNCTION__, func_get_args() ); } + public function wasErrorReissuable() { + return $this->__call( __FUNCTION__, func_get_args() ); + } + public function masterPosWait( DBMasterPos $pos, $timeout ) { return $this->__call( __FUNCTION__, func_get_args() ); } @@ -491,7 +495,9 @@ class DBConnRef implements IDatabase { return $this->__call( __FUNCTION__, func_get_args() ); } - public function startAtomic( $fname = __METHOD__ ) { + public function startAtomic( + $fname = __METHOD__, $cancelable = IDatabase::ATOMIC_NOT_CANCELABLE + ) { return $this->__call( __FUNCTION__, func_get_args() ); } @@ -499,7 +505,13 @@ class DBConnRef implements IDatabase { return $this->__call( __FUNCTION__, func_get_args() ); } - public function doAtomicSection( $fname, callable $callback ) { + public function cancelAtomic( $fname = __METHOD__, AtomicSectionIdentifier $sectionId = null ) { + return $this->__call( __FUNCTION__, func_get_args() ); + } + + public function doAtomicSection( + $fname, callable $callback, $cancelable = self::ATOMIC_NOT_CANCELABLE + ) { return $this->__call( __FUNCTION__, func_get_args() ); } @@ -519,10 +531,6 @@ class DBConnRef implements IDatabase { return $this->__call( __FUNCTION__, func_get_args() ); } - 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() ); } @@ -609,6 +617,10 @@ class DBConnRef implements IDatabase { return $this->__call( __FUNCTION__, func_get_args() ); } + public function setIndexAliases( array $aliases ) { + return $this->__call( __FUNCTION__, func_get_args() ); + } + /** * Clean up the connection when out of scope */