Merge "jquery.migrate: Instrument with mw.track()"
[lhc/web/wiklou.git] / includes / libs / rdbms / database / DBConnRef.php
index 0d5fbf5..ef2953e 100644 (file)
@@ -2,14 +2,13 @@
 
 namespace Wikimedia\Rdbms;
 
-use Database;
 use InvalidArgumentException;
 
 /**
  * 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
  *
- * @note: proxy methods are defined explicity to avoid interface errors
+ * @note: proxy methods are defined explicitly to avoid interface errors
  * @ingroup Database
  * @since 1.22
  */
@@ -24,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 ( count( $conn ) >= 4 && $conn[self::FLD_DOMAIN] !== false ) {
                        $this->params = $conn;
                } else {
                        throw new InvalidArgumentException( "Missing lazy connection arguments." );
@@ -42,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 );
@@ -125,6 +125,10 @@ class DBConnRef implements IDatabase {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
+       public function pendingWriteRowsAffected() {
+               return $this->__call( __FUNCTION__, func_get_args() );
+       }
+
        public function isOpen() {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
@@ -244,13 +248,13 @@ class DBConnRef implements IDatabase {
        }
 
        public function selectField(
-               $table, $var, $cond = '', $fname = __METHOD__, $options = []
+               $table, $var, $cond = '', $fname = __METHOD__, $options = [], $join_conds = []
        ) {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
        public function selectFieldValues(
-               $table, $var, $cond = '', $fname = __METHOD__, $options = []
+               $table, $var, $cond = '', $fname = __METHOD__, $options = [], $join_conds = []
        ) {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
@@ -350,6 +354,10 @@ class DBConnRef implements IDatabase {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
+       public function databasesAreIndependent() {
+               return $this->__call( __FUNCTION__, func_get_args() );
+       }
+
        public function selectDB( $db ) {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
@@ -404,7 +412,7 @@ class DBConnRef implements IDatabase {
 
        public function insertSelect(
                $destTable, $srcTable, $varMap, $conds,
-               $fname = __METHOD__, $insertOptions = [], $selectOptions = []
+               $fname = __METHOD__, $insertOptions = [], $selectOptions = [], $selectJoinConds = []
        ) {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
@@ -417,6 +425,13 @@ class DBConnRef implements IDatabase {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
+       public function unionConditionPermutations(
+               $table, $vars, array $permute_conds, $extra_conds = '', $fname = __METHOD__,
+               $options = [], $join_conds = []
+       ) {
+               return $this->__call( __FUNCTION__, func_get_args() );
+       }
+
        public function conditional( $cond, $trueVal, $falseVal ) {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
@@ -605,4 +620,4 @@ class DBConnRef implements IDatabase {
        }
 }
 
-class_alias( 'Wikimedia\Rdbms\DBConnRef', 'DBConnRef' );
+class_alias( DBConnRef::class, 'DBConnRef' );