Merge "Recalculate user default options for each test"
[lhc/web/wiklou.git] / includes / libs / rdbms / database / IDatabase.php
index 7d9eac1..b4440d6 100644 (file)
@@ -106,6 +106,19 @@ interface IDatabase {
        /** @var int Enable compression in connection protocol */
        const DBO_COMPRESS = 512;
 
+       /** @var int Ignore query errors and return false when they happen */
+       const QUERY_SILENCE_ERRORS = 1; // b/c for 1.32 query() argument; note that (int)true = 1
+       /**
+        * @var int Treat the TEMPORARY table from the given CREATE query as if it is
+        *   permanent as far as write tracking is concerned. This is useful for testing.
+        */
+       const QUERY_PSEUDO_PERMANENT = 2;
+
+       /** @var bool Parameter to unionQueries() for UNION ALL */
+       const UNION_ALL = true;
+       /** @var bool Parameter to unionQueries() for UNION DISTINCT */
+       const UNION_DISTINCT = false;
+
        /**
         * A string describing the current software version, and possibly
         * other details in a user-friendly way. Will be listed on Special:Version, etc.
@@ -527,13 +540,13 @@ interface IDatabase {
         * @param string $sql SQL query
         * @param string $fname Name of the calling function, for profiling/SHOW PROCESSLIST
         *     comment (you can use __METHOD__ or add some extra info)
-        * @param bool $tempIgnore Whether to avoid throwing an exception on errors...
-        *     maybe best to catch the exception instead?
+        * @param int $flags Bitfield of IDatabase::QUERY_* constants. Note that suppression
+        *     of errors is best handled by try/catch rather than using one of these flags.
         * @return bool|IResultWrapper True for a successful write query, IResultWrapper object
-        *     for a successful read query, or false on failure if $tempIgnore set
+        *     for a successful read query, or false on failure if QUERY_SILENCE_ERRORS is set.
         * @throws DBError
         */
-       public function query( $sql, $fname = __METHOD__, $tempIgnore = false );
+       public function query( $sql, $fname = __METHOD__, $flags = 0 );
 
        /**
         * Free a result object returned by query() or select(). It's usually not
@@ -583,7 +596,7 @@ interface IDatabase {
         * @param string|array $options The query options. See IDatabase::select() for details.
         * @param string|array $join_conds The query join conditions. See IDatabase::select() for details.
         *
-        * @return array The values from the field
+        * @return array The values from the field in the order they were returned from the DB
         * @throws DBError
         * @since 1.25
         */
@@ -1232,8 +1245,10 @@ interface IDatabase {
         * errors which wouldn't have occurred in MySQL.
         *
         * @param string $table The table to replace the row(s) in.
-        * @param array $uniqueIndexes Either a list of fields that define a unique index or
-        *   an array of such lists if there are multiple unique indexes defined in the schema
+        * @param array[]|string[]|string $uniqueIndexes All unique indexes. One of the following:
+        *   a) the one unique field in the table (when no composite unique key exist)
+        *   b) a list of all unique fields in the table (when no composite unique key exist)
+        *   c) a list of all unique indexes in the table (each as a list of the indexed fields)
         * @param array $rows Can be either a single row to insert, or multiple rows,
         *   in the same format as for IDatabase::insert()
         * @param string $fname Calling function name (use __METHOD__) for logs/profiling
@@ -1267,8 +1282,10 @@ interface IDatabase {
         *
         * @param string $table Table name. This will be passed through Database::tableName().
         * @param array $rows A single row or list of rows to insert
-        * @param array $uniqueIndexes Either a list of fields that define a unique index or
-        *   an array of such lists if there are multiple unique indexes defined in the schema
+        * @param array[]|string[]|string $uniqueIndexes All unique indexes. One of the following:
+        *   a) the one unique field in the table (when no composite unique key exist)
+        *   b) a list of all unique fields in the table (when no composite unique key exist)
+        *   c) a list of all unique indexes in the table (each as a list of the indexed fields)
         * @param array $set An array of values to SET. For each array element, the
         *   key gives the field name, and the value gives the data to set that
         *   field to. The data will be quoted by IDatabase::addQuotes().
@@ -1279,7 +1296,7 @@ interface IDatabase {
         * @return bool Return true if no exception was thrown (deprecated since 1.33)
         */
        public function upsert(
-               $table, array $rows, array $uniqueIndexes, array $set, $fname = __METHOD__
+               $table, array $rows, $uniqueIndexes, array $set, $fname = __METHOD__
        );
 
        /**
@@ -1372,7 +1389,7 @@ interface IDatabase {
         * This is used for providing overload point for other DB abstractions
         * not compatible with the MySQL syntax.
         * @param array $sqls SQL statements to combine
-        * @param bool $all Use UNION ALL
+        * @param bool $all Either IDatabase::UNION_ALL or IDatabase::UNION_DISTINCT
         * @return string SQL fragment
         */
        public function unionQueries( $sqls, $all );