rdbms: inject the mysql index name aliases into Database
[lhc/web/wiklou.git] / includes / libs / rdbms / lbfactory / ILBFactory.php
index 98108a7..32d9008 100644 (file)
@@ -42,19 +42,19 @@ interface ILBFactory {
         *
         * @param array $conf Array with keys:
         *  - localDomain: A DatabaseDomain or domain ID string.
         *
         * @param array $conf Array with keys:
         *  - localDomain: A DatabaseDomain or domain ID string.
-        *  - readOnlyReason : Reason the master DB is read-only if so [optional]
-        *  - srvCache : BagOStuff object for server cache [optional]
-        *  - memStash : BagOStuff object for cross-datacenter memory storage [optional]
-        *  - wanCache : WANObjectCache object [optional]
-        *  - hostname : The name of the current server [optional]
+        *  - readOnlyReason: Reason the master DB is read-only if so [optional]
+        *  - srvCache: BagOStuff object for server cache [optional]
+        *  - memStash: BagOStuff object for cross-datacenter memory storage [optional]
+        *  - wanCache: WANObjectCache object [optional]
+        *  - hostname: The name of the current server [optional]
         *  - cliMode: Whether the execution context is a CLI script. [optional]
         *  - cliMode: Whether the execution context is a CLI script. [optional]
-        *  - profiler : Class name or instance with profileIn()/profileOut() methods. [optional]
+        *  - profiler: Class name or instance with profileIn()/profileOut() methods. [optional]
         *  - trxProfiler: TransactionProfiler instance. [optional]
         *  - replLogger: PSR-3 logger instance. [optional]
         *  - connLogger: PSR-3 logger instance. [optional]
         *  - queryLogger: PSR-3 logger instance. [optional]
         *  - perfLogger: PSR-3 logger instance. [optional]
         *  - trxProfiler: TransactionProfiler instance. [optional]
         *  - replLogger: PSR-3 logger instance. [optional]
         *  - connLogger: PSR-3 logger instance. [optional]
         *  - queryLogger: PSR-3 logger instance. [optional]
         *  - perfLogger: PSR-3 logger instance. [optional]
-        *  - errorLogger : Callback that takes an Exception and logs it. [optional]
+        *  - errorLogger: Callback that takes an Exception and logs it. [optional]
         * @throws InvalidArgumentException
         */
        public function __construct( array $conf );
         * @throws InvalidArgumentException
         */
        public function __construct( array $conf );
@@ -323,4 +323,34 @@ interface ILBFactory {
         *   - ChronologyPositionIndex: timestamp used to get up-to-date DB positions for the agent
         */
        public function setRequestInfo( array $info );
         *   - ChronologyPositionIndex: timestamp used to get up-to-date DB positions for the agent
         */
        public function setRequestInfo( array $info );
+
+       /**
+        * Make certain table names use their own database, schema, and table prefix
+        * when passed into SQL queries pre-escaped and without a qualified database name
+        *
+        * For example, "user" can be converted to "myschema.mydbname.user" for convenience.
+        * Appearances like `user`, somedb.user, somedb.someschema.user will used literally.
+        *
+        * Calling this twice will completely clear any old table aliases. Also, note that
+        * callers are responsible for making sure the schemas and databases actually exist.
+        *
+        * @param array[] $aliases Map of (table => (dbname, schema, prefix) map)
+        * @since 1.31
+        */
+       public function setTableAliases( array $aliases );
+
+       /**
+        * Convert certain index names to alternative names before querying the DB
+        *
+        * Note that this applies to indexes regardless of the table they belong to.
+        *
+        * This can be employed when an index was renamed X => Y in code, but the new Y-named
+        * indexes were not yet built on all DBs. After all the Y-named ones are added by the DBA,
+        * the aliases can be removed, and then the old X-named indexes dropped.
+        *
+        * @param string[] $aliases
+        * @return mixed
+        * @since 1.31
+        */
+       public function setIndexAliases( array $aliases );
 }
 }