Merge "Enable configuration to supply options for Special:Search form"
[lhc/web/wiklou.git] / includes / libs / rdbms / database / IDatabase.php
index e25b4d2..aeefacd 100644 (file)
@@ -247,8 +247,8 @@ interface IDatabase {
        public function implicitOrderby();
 
        /**
-        * Return the last query that went through IDatabase::query()
-        * @return string
+        * Return the last query that sent on account of IDatabase::query()
+        * @return string SQL text or empty string if there was no such query
         */
        public function lastQuery();
 
@@ -431,7 +431,7 @@ interface IDatabase {
 
        /**
         * Get the number of fields in a result object
-        * @see https://secure.php.net/mysql_num_fields
+        * @see https://www.php.net/mysql_num_fields
         *
         * @param mixed $res A SQL result
         * @return int
@@ -440,7 +440,7 @@ interface IDatabase {
 
        /**
         * Get a field name in a result object
-        * @see https://secure.php.net/mysql_field_name
+        * @see https://www.php.net/mysql_field_name
         *
         * @param mixed $res A SQL result
         * @param int $n
@@ -461,7 +461,7 @@ interface IDatabase {
 
        /**
         * Change the position of the cursor in a result object
-        * @see https://secure.php.net/mysql_data_seek
+        * @see https://www.php.net/mysql_data_seek
         *
         * @param mixed $res A SQL result
         * @param int $row
@@ -470,7 +470,7 @@ interface IDatabase {
 
        /**
         * Get the last error number
-        * @see https://secure.php.net/mysql_errno
+        * @see https://www.php.net/mysql_errno
         *
         * @return int
         */
@@ -478,7 +478,7 @@ interface IDatabase {
 
        /**
         * Get a description of the last error
-        * @see https://secure.php.net/mysql_error
+        * @see https://www.php.net/mysql_error
         *
         * @return string
         */
@@ -486,7 +486,7 @@ interface IDatabase {
 
        /**
         * Get the number of rows affected by the last write query
-        * @see https://secure.php.net/mysql_affected_rows
+        * @see https://www.php.net/mysql_affected_rows
         *
         * @return int
         */
@@ -713,7 +713,8 @@ interface IDatabase {
         *     is applied to a result set after OFFSET.
         *
         *   - FOR UPDATE: Boolean: lock the returned rows so that they can't be
-        *     changed until the next COMMIT.
+        *     changed until the next COMMIT. Cannot be used with aggregate functions
+        *     (COUNT, MAX, etc., but also DISTINCT).
         *
         *   - DISTINCT: Boolean: return only unique result rows.
         *
@@ -1112,6 +1113,25 @@ interface IDatabase {
                $options = [], $join_conds = []
        );
 
+       /**
+        * Construct a LIMIT query with optional offset. This is used for query
+        * pages. The SQL should be adjusted so that only the first $limit rows
+        * are returned. If $offset is provided as well, then the first $offset
+        * rows should be discarded, and the next $limit rows should be returned.
+        * If the result of the query is not ordered, then the rows to be returned
+        * are theoretically arbitrary.
+        *
+        * $sql is expected to be a SELECT, if that makes a difference.
+        *
+        * @param string $sql SQL query we will append the limit too
+        * @param int $limit The SQL limit
+        * @param int|bool $offset The SQL offset (default false)
+        * @throws DBUnexpectedError
+        * @return string
+        * @since 1.34
+        */
+       public function limitResult( $sql, $limit, $offset = false );
+
        /**
         * Returns true if DBs are assumed to be on potentially different servers
         *