Rename getSlavePos() => getReplicaPos()
[lhc/web/wiklou.git] / includes / libs / rdbms / database / DBConnRef.php
index 9035bbd..20198bf 100644 (file)
@@ -14,22 +14,22 @@ class DBConnRef implements IDatabase {
        /** @var IDatabase|null Live connection handle */
        private $conn;
 
-       /** @var array|null */
+       /** @var array|null N-tuple of (server index, group, DatabaseDomain|string) */
        private $params;
 
        const FLD_INDEX = 0;
        const FLD_GROUP = 1;
-       const FLD_WIKI = 2;
+       const FLD_DOMAIN = 2;
 
        /**
         * @param ILoadBalancer $lb
-        * @param IDatabase|array $conn Connection or (server index, group, wiki ID)
+        * @param IDatabase|array $conn Connection or (server index, group, DatabaseDomain|string)
         */
        public function __construct( ILoadBalancer $lb, $conn ) {
                $this->lb = $lb;
                if ( $conn instanceof IDatabase ) {
                        $this->conn = $conn; // live handle
-               } elseif ( count( $conn ) >= 3 && $conn[self::FLD_WIKI] !== false ) {
+               } elseif ( count( $conn ) >= 3 && $conn[self::FLD_DOMAIN] !== false ) {
                        $this->params = $conn;
                } else {
                        throw new InvalidArgumentException( "Missing lazy connection arguments." );
@@ -145,15 +145,20 @@ class DBConnRef implements IDatabase {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
-       public function getWikiID() {
+       public function getDomainID() {
                if ( $this->conn === null ) {
-                       // Avoid triggering a connection
-                       return $this->params[self::FLD_WIKI];
+                       $domain = $this->params[self::FLD_DOMAIN];
+                       // Avoid triggering a database connection
+                       return $domain instanceof DatabaseDomain ? $domain->getId() : $domain;
                }
 
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
+       public function getWikiID() {
+               return $this->getDomainID();
+       }
+
        public function getType() {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
@@ -303,7 +308,7 @@ class DBConnRef implements IDatabase {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
-       public function makeList( $a, $mode = LIST_COMMA ) {
+       public function makeList( $a, $mode = self::LIST_COMMA ) {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
@@ -311,6 +316,10 @@ class DBConnRef implements IDatabase {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
+       public function aggregateValue( $valuedata, $valuename = 'value' ) {
+               return $this->__call( __FUNCTION__, func_get_args() );
+       }
+
        public function bitNot( $field ) {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
@@ -333,6 +342,10 @@ class DBConnRef implements IDatabase {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
+       public function buildStringCast( $field ) {
+               return $this->__call( __FUNCTION__, func_get_args() );
+       }
+
        public function selectDB( $db ) {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
@@ -432,7 +445,7 @@ class DBConnRef implements IDatabase {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
-       public function getSlavePos() {
+       public function getReplicaPos() {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
@@ -444,15 +457,15 @@ class DBConnRef implements IDatabase {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
-       public function onTransactionResolution( callable $callback ) {
+       public function onTransactionResolution( callable $callback, $fname = __METHOD__ ) {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
-       public function onTransactionIdle( callable $callback ) {
+       public function onTransactionIdle( callable $callback, $fname = __METHOD__ ) {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
-       public function onTransactionPreCommitOrIdle( callable $callback ) {
+       public function onTransactionPreCommitOrIdle( callable $callback, $fname = __METHOD__ ) {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
@@ -574,6 +587,10 @@ class DBConnRef implements IDatabase {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
+       public function setTableAliases( array $aliases ) {
+               return $this->__call( __FUNCTION__, func_get_args() );
+       }
+
        /**
         * Clean up the connection when out of scope
         */