r91248 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91247‎ | r91248 | r91249 >
Date:02:57, 1 July 2011
Author:reedy
Status:ok
Tags:
Comment:
Add documentation

Trim trailing whitespace
Modified paths:
  • /trunk/phase3/includes/db/Database.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/Database.php
@@ -241,7 +241,7 @@
242242 }
243243
244244 /**
245 - * Boolean, controls output of large amounts of debug information.
 245+ * Boolean, controls output of large amounts of debug information.
246246 * @param $debug:
247247 * - true to enable debugging
248248 * - false to disable debugging
@@ -254,23 +254,25 @@
255255 }
256256
257257 /**
258 - * Turns buffering of SQL result sets on (true) or off (false). Default is
259 - * "on".
 258+ * Turns buffering of SQL result sets on (true) or off (false). Default is
 259+ * "on".
260260 *
261261 * Unbuffered queries are very troublesome in MySQL:
262262 *
263 - * - If another query is executed while the first query is being read
 263+ * - If another query is executed while the first query is being read
264264 * out, the first query is killed. This means you can't call normal
265265 * MediaWiki functions while you are reading an unbuffered query result
266266 * from a normal wfGetDB() connection.
267267 *
268 - * - Unbuffered queries cause the MySQL server to use large amounts of
 268+ * - Unbuffered queries cause the MySQL server to use large amounts of
269269 * memory and to hold broad locks which block other queries.
270270 *
271 - * If you want to limit client-side memory, it's almost always better to
 271+ * If you want to limit client-side memory, it's almost always better to
272272 * split up queries into batches using a LIMIT clause than to switch off
273273 * buffering.
274274 *
 275+ * @param $buffer null|bool
 276+ *
275277 * @return The previous value of the flag
276278 */
277279 function bufferResults( $buffer = null ) {
@@ -297,7 +299,7 @@
298300 /**
299301 * Gets or sets the current transaction level.
300302 *
301 - * Historically, transactions were allowed to be "nested". This is no
 303+ * Historically, transactions were allowed to be "nested". This is no
302304 * longer supported, so this function really only returns a boolean.
303305 *
304306 * @param $level An integer (0 or 1), or omitted to leave it unchanged.
@@ -326,10 +328,10 @@
327329 }
328330
329331 /**
330 - * Get properties passed down from the server info array of the load
 332+ * Get properties passed down from the server info array of the load
331333 * balancer.
332334 *
333 - * @param $name The entry of the info array to get, or null to get the
 335+ * @param $name The entry of the info array to get, or null to get the
334336 * whole array
335337 */
336338 function getLBInfo( $name = null ) {
@@ -345,8 +347,8 @@
346348 }
347349
348350 /**
349 - * Set the LB info array, or a member of it. If called with one parameter,
350 - * the LB info array is set to that parameter. If it is called with two
 351+ * Set the LB info array, or a member of it. If called with one parameter,
 352+ * the LB info array is set to that parameter. If it is called with two
351353 * parameters, the member with the given name is set to the given value.
352354 *
353355 * @param $name
@@ -695,14 +697,14 @@
696698 }
697699
698700 /**
699 - * Run an SQL query and return the result. Normally throws a DBQueryError
 701+ * Run an SQL query and return the result. Normally throws a DBQueryError
700702 * on failure. If errors are ignored, returns false instead.
701703 *
702 - * In new code, the query wrappers select(), insert(), update(), delete(),
703 - * etc. should be used where possible, since they give much better DBMS
 704+ * In new code, the query wrappers select(), insert(), update(), delete(),
 705+ * etc. should be used where possible, since they give much better DBMS
704706 * independence and automatically quote or validate user input in a variety
705707 * of contexts. This function is generally only useful for queries which are
706 - * explicitly DBMS-dependent and are unsupported by the query wrappers, such
 708+ * explicitly DBMS-dependent and are unsupported by the query wrappers, such
707709 * as CREATE TABLE.
708710 *
709711 * However, the query wrappers themselves should call this function.
@@ -712,7 +714,7 @@
713715 * comment (you can use __METHOD__ or add some extra info)
714716 * @param $tempIgnore Boolean: Whether to avoid throwing an exception on errors...
715717 * maybe best to catch the exception instead?
716 - * @return boolean|ResultWrapper. true for a successful write query, ResultWrapper object
 718+ * @return boolean|ResultWrapper. true for a successful write query, ResultWrapper object
717719 * for a successful read query, or false on failure if $tempIgnore set
718720 * @throws DBQueryError Thrown when the database returns an error of any kind
719721 */
@@ -821,7 +823,7 @@
822824 }
823825
824826 /**
825 - * Report a query error. Log the error, and if neither the object ignore
 827+ * Report a query error. Log the error, and if neither the object ignore
826828 * flag nor the $tempIgnore flag is set, throw a DBQueryError.
827829 *
828830 * @param $error String
@@ -855,7 +857,7 @@
856858 * & = filename; reads the file and inserts as a blob
857859 * (we don't use this though...)
858860 *
859 - * This function should not be used directly by new code outside of the
 861+ * This function should not be used directly by new code outside of the
860862 * database classes. The query wrapper functions (select() etc.) should be
861863 * used instead.
862864 *
@@ -898,7 +900,7 @@
899901 * Prepare & execute an SQL statement, quoting and inserting arguments
900902 * in the appropriate places.
901903 *
902 - * This function should not be used directly by new code outside of the
 904+ * This function should not be used directly by new code outside of the
903905 * database classes. The query wrapper functions (select() etc.) should be
904906 * used instead.
905907 *
@@ -967,8 +969,8 @@
968970 }
969971
970972 /**
971 - * Free a result object returned by query() or select(). It's usually not
972 - * necessary to call this, just use unset() or let the variable holding
 973+ * Free a result object returned by query() or select(). It's usually not
 974+ * necessary to call this, just use unset() or let the variable holding
973975 * the result object go out of scope.
974976 *
975977 * @param $res Mixed: A SQL result
@@ -997,22 +999,22 @@
9981000 /**
9991001 * A SELECT wrapper which returns a single field from a single result row.
10001002 *
1001 - * Usually throws a DBQueryError on failure. If errors are explicitly
 1003+ * Usually throws a DBQueryError on failure. If errors are explicitly
10021004 * ignored, returns false on failure.
10031005 *
10041006 * If no result rows are returned from the query, false is returned.
10051007 *
1006 - * @param $table Table name. See DatabaseBase::select() for details.
1007 - * @param $var The field name to select. This must be a valid SQL
 1008+ * @param $table string|array Table name. See DatabaseBase::select() for details.
 1009+ * @param $var string The field name to select. This must be a valid SQL
10081010 * fragment: do not use unvalidated user input.
1009 - * @param $cond The condition array. See DatabaseBase::select() for details.
1010 - * @param $fname The function name of the caller.
1011 - * @param $options The query options. See DatabaseBase::select() for details.
 1011+ * @param $cond string|array The condition array. See DatabaseBase::select() for details.
 1012+ * @param $fname string The function name of the caller.
 1013+ * @param $options string|array The query options. See DatabaseBase::select() for details.
10121014 *
10131015 * @return The value from the field, or false on failure.
10141016 */
1015 - function selectField( $table, $var, $cond = '', $fname = 'DatabaseBase::selectField',
1016 - $options = array() )
 1017+ function selectField( $table, $var, $cond = '', $fname = 'DatabaseBase::selectField',
 1018+ $options = array() )
10171019 {
10181020 if ( !is_array( $options ) ) {
10191021 $options = array( $options );
@@ -1037,7 +1039,7 @@
10381040
10391041 /**
10401042 * Returns an optional USE INDEX clause to go after the table, and a
1041 - * string to go at the end of the query.
 1043+ * string to go at the end of the query.
10421044 *
10431045 * @param $options Array: associative array of options to be turned into
10441046 * an SQL query, valid keys are listed in the function.
@@ -1146,102 +1148,102 @@
11471149 * @param $join_conds Array Join conditions
11481150 *
11491151 *
1150 - * @b $table
 1152+ * @param $table string|array
11511153 *
1152 - * May be either an array of table names, or a single string holding a table
1153 - * name. If an array is given, table aliases can be specified, for example:
 1154+ * May be either an array of table names, or a single string holding a table
 1155+ * name. If an array is given, table aliases can be specified, for example:
11541156 *
11551157 * array( 'a' => 'user' )
11561158 *
1157 - * This includes the user table in the query, with the alias "a" available
 1159+ * This includes the user table in the query, with the alias "a" available
11581160 * for use in field names (e.g. a.user_name).
11591161 *
1160 - * All of the table names given here are automatically run through
1161 - * DatabaseBase::tableName(), which causes the table prefix (if any) to be
 1162+ * All of the table names given here are automatically run through
 1163+ * DatabaseBase::tableName(), which causes the table prefix (if any) to be
11621164 * added, and various other table name mappings to be performed.
11631165 *
11641166 *
1165 - * @b $vars
 1167+ * @param $vars string|array
11661168 *
1167 - * May be either a field name or an array of field names. The field names
1168 - * here are complete fragments of SQL, for direct inclusion into the SELECT
 1169+ * May be either a field name or an array of field names. The field names
 1170+ * here are complete fragments of SQL, for direct inclusion into the SELECT
11691171 * query. Expressions and aliases may be specified as in SQL, for example:
11701172 *
11711173 * array( 'MAX(rev_id) AS maxrev' )
1172 - *
1173 - * If an expression is given, care must be taken to ensure that it is
 1174+ *
 1175+ * If an expression is given, care must be taken to ensure that it is
11741176 * DBMS-independent.
11751177 *
11761178 *
1177 - * @b $conds
 1179+ * @param $conds string|array
11781180 *
1179 - * May be either a string containing a single condition, or an array of
1180 - * conditions. If an array is given, the conditions constructed from each
1181 - * element are combined with AND.
 1181+ * May be either a string containing a single condition, or an array of
 1182+ * conditions. If an array is given, the conditions constructed from each
 1183+ * element are combined with AND.
11821184 *
11831185 * Array elements may take one of two forms:
11841186 *
11851187 * - Elements with a numeric key are interpreted as raw SQL fragments.
1186 - * - Elements with a string key are interpreted as equality conditions,
 1188+ * - Elements with a string key are interpreted as equality conditions,
11871189 * where the key is the field name.
1188 - * - If the value of such an array element is a scalar (such as a
1189 - * string), it will be treated as data and thus quoted appropriately.
 1190+ * - If the value of such an array element is a scalar (such as a
 1191+ * string), it will be treated as data and thus quoted appropriately.
11901192 * If it is null, an IS NULL clause will be added.
1191 - * - If the value is an array, an IN(...) clause will be constructed,
1192 - * such that the field name may match any of the elements in the
 1193+ * - If the value is an array, an IN(...) clause will be constructed,
 1194+ * such that the field name may match any of the elements in the
11931195 * array. The elements of the array will be quoted.
1194 - * - If the field name ends with "!", this is taken as a flag which
1195 - * inverts the comparison, allowing NOT IN clauses to be constructed,
 1196+ * - If the field name ends with "!", this is taken as a flag which
 1197+ * inverts the comparison, allowing NOT IN clauses to be constructed,
11961198 * for example: array( 'user_id!' => array( 1, 2, 3 ) )
11971199 *
1198 - * Note that expressions are often DBMS-dependent in their syntax.
1199 - * DBMS-independent wrappers are provided for constructing several types of
 1200+ * Note that expressions are often DBMS-dependent in their syntax.
 1201+ * DBMS-independent wrappers are provided for constructing several types of
12001202 * expression commonly used in condition queries. See:
12011203 * - DatabaseBase::buildLike()
12021204 * - DatabaseBase::conditional()
12031205 *
12041206 *
1205 - * @b $options
 1207+ * @param $options string|array
12061208 *
1207 - * Optional: Array of query options. Boolean options are specified by
1208 - * including them in the array as a string value with a numeric key, for
 1209+ * Optional: Array of query options. Boolean options are specified by
 1210+ * including them in the array as a string value with a numeric key, for
12091211 * example:
12101212 *
12111213 * array( 'FOR UPDATE' )
12121214 *
12131215 * The supported options are:
12141216 *
1215 - * - OFFSET: Skip this many rows at the start of the result set. OFFSET
 1217+ * - OFFSET: Skip this many rows at the start of the result set. OFFSET
12161218 * with LIMIT can theoretically be used for paging through a result set,
1217 - * but this is discouraged in MediaWiki for performance reasons.
 1219+ * but this is discouraged in MediaWiki for performance reasons.
12181220 *
1219 - * - LIMIT: Integer: return at most this many rows. The rows are sorted
 1221+ * - LIMIT: Integer: return at most this many rows. The rows are sorted
12201222 * and then the first rows are taken until the limit is reached. LIMIT
12211223 * is applied to a result set after OFFSET.
12221224 *
1223 - * - FOR UPDATE: Boolean: lock the returned rows so that they can't be
 1225+ * - FOR UPDATE: Boolean: lock the returned rows so that they can't be
12241226 * changed until the next COMMIT.
12251227 *
12261228 * - DISTINCT: Boolean: return only unique result rows.
12271229 *
1228 - * - GROUP BY: May be either an SQL fragment string naming a field or
 1230+ * - GROUP BY: May be either an SQL fragment string naming a field or
12291231 * expression to group by, or an array of such SQL fragments.
12301232 *
1231 - * - HAVING: A string containing a HAVING clause.
 1233+ * - HAVING: A string containing a HAVING clause.
12321234 *
1233 - * - ORDER BY: May be either an SQL fragment giving a field name or
 1235+ * - ORDER BY: May be either an SQL fragment giving a field name or
12341236 * expression to order by, or an array of such SQL fragments.
12351237 *
1236 - * - USE INDEX: This may be either a string giving the index name to use
1237 - * for the query, or an array. If it is an associative array, each key
 1238+ * - USE INDEX: This may be either a string giving the index name to use
 1239+ * for the query, or an array. If it is an associative array, each key
12381240 * gives the table name (or alias), each value gives the index name to
1239 - * use for that table. All strings are SQL fragments and so should be
 1241+ * use for that table. All strings are SQL fragments and so should be
12401242 * validated by the caller.
12411243 *
1242 - * - EXPLAIN: In MySQL, this causes an EXPLAIN SELECT query to be run,
 1244+ * - EXPLAIN: In MySQL, this causes an EXPLAIN SELECT query to be run,
12431245 * instead of SELECT.
12441246 *
1245 - * And also the following boolean MySQL extensions, see the MySQL manual
 1247+ * And also the following boolean MySQL extensions, see the MySQL manual
12461248 * for documentation:
12471249 *
12481250 * - LOCK IN SHARE MODE
@@ -1255,27 +1257,26 @@
12561258 * - SQL_NO_CACHE
12571259 *
12581260 *
1259 - * @b $join_conds
 1261+ * @param $join_conds string|array
12601262 *
1261 - * Optional associative array of table-specific join conditions. In the
1262 - * most common case, this is unnecessary, since the join condition can be
 1263+ * Optional associative array of table-specific join conditions. In the
 1264+ * most common case, this is unnecessary, since the join condition can be
12631265 * in $conds. However, it is useful for doing a LEFT JOIN.
12641266 *
1265 - * The key of the array contains the table name or alias. The value is an
1266 - * array with two elements, numbered 0 and 1. The first gives the type of
1267 - * join, the second is an SQL fragment giving the join condition for that
 1267+ * The key of the array contains the table name or alias. The value is an
 1268+ * array with two elements, numbered 0 and 1. The first gives the type of
 1269+ * join, the second is an SQL fragment giving the join condition for that
12681270 * table. For example:
12691271 *
12701272 * array( 'page' => array('LEFT JOIN','page_latest=rev_id') )
12711273 *
12721274 * @return ResultWrapper. If the query returned no rows, a ResultWrapper
1273 - * with no rows in it will be returned. If there was a query error, a
 1275+ * with no rows in it will be returned. If there was a query error, a
12741276 * DBQueryError exception will be thrown, except if the "ignore errors"
12751277 * option was set, in which case false will be returned.
12761278 */
1277 - function select( $table, $vars, $conds = '', $fname = 'DatabaseBase::select',
1278 - $options = array(), $join_conds = array() )
1279 - {
 1279+ function select( $table, $vars, $conds = '', $fname = 'DatabaseBase::select',
 1280+ $options = array(), $join_conds = array() ) {
12801281 $sql = $this->selectSQLText( $table, $vars, $conds, $fname, $options, $join_conds );
12811282
12821283 return $this->query( $sql, $fname );
@@ -1285,12 +1286,12 @@
12861287 * The equivalent of DatabaseBase::select() except that the constructed SQL
12871288 * is returned, instead of being immediately executed.
12881289 *
1289 - * @param $table Table name
1290 - * @param $vars Field names
1291 - * @param $conds Conditions
1292 - * @param $fname Caller function name
1293 - * @param $options Query options
1294 - * @param $join_conds Join conditions
 1290+ * @param $table string|array Table name
 1291+ * @param $vars string|array Field names
 1292+ * @param $conds string|array Conditions
 1293+ * @param $fname string Caller function name
 1294+ * @param $options string|array Query options
 1295+ * @param $join_conds string|array Join conditions
12951296 *
12961297 * @return SQL query string.
12971298 * @see DatabaseBase::select()
@@ -1348,20 +1349,20 @@
13491350
13501351 /**
13511352 * Single row SELECT wrapper. Equivalent to DatabaseBase::select(), except
1352 - * that a single row object is returned. If the query returns no rows,
 1353+ * that a single row object is returned. If the query returns no rows,
13531354 * false is returned.
13541355 *
1355 - * @param $table Table name
1356 - * @param $vars Field names
1357 - * @param $conds Conditions
1358 - * @param $fname Caller function name
1359 - * @param $options Query options
1360 - * @param $join_conds Join conditions
 1356+ * @param $table string|array Table name
 1357+ * @param $vars string|array Field names
 1358+ * @param $conds|array Conditions
 1359+ * @param $fname string Caller function name
 1360+ * @param $options string|array Query options
 1361+ * @param $join_conds array|string Join conditions
13611362 *
1362 - * @return ResultWrapper or bool
 1363+ * @return ResultWrapper|bool
13631364 */
1364 - function selectRow( $table, $vars, $conds, $fname = 'DatabaseBase::selectRow',
1365 - $options = array(), $join_conds = array() )
 1365+ function selectRow( $table, $vars, $conds, $fname = 'DatabaseBase::selectRow',
 1366+ $options = array(), $join_conds = array() )
13661367 {
13671368 $options['LIMIT'] = 1;
13681369 $res = $this->select( $table, $vars, $conds, $fname, $options, $join_conds );
@@ -1382,13 +1383,13 @@
13831384 /**
13841385 * Estimate rows in dataset.
13851386 *
1386 - * MySQL allows you to estimate the number of rows that would be returned
 1387+ * MySQL allows you to estimate the number of rows that would be returned
13871388 * by a SELECT query, using EXPLAIN SELECT. The estimate is provided using
13881389 * index cardinality statistics, and is notoriously inaccurate, especially
13891390 * when large numbers of rows have recently been added or deleted.
13901391 *
13911392 * For DBMSs that don't support fast result size estimation, this function
1392 - * will actually perform the SELECT COUNT(*).
 1393+ * will actually perform the SELECT COUNT(*).
13931394 *
13941395 * Takes the same arguments as DatabaseBase::select().
13951396 *
@@ -1399,8 +1400,8 @@
14001401 * @param $options Array: options for select
14011402 * @return Integer: row count
14021403 */
1403 - public function estimateRowCount( $table, $vars = '*', $conds = '',
1404 - $fname = 'DatabaseBase::estimateRowCount', $options = array() )
 1404+ public function estimateRowCount( $table, $vars = '*', $conds = '',
 1405+ $fname = 'DatabaseBase::estimateRowCount', $options = array() )
14051406 {
14061407 $rows = 0;
14071408 $res = $this->select ( $table, 'COUNT(*) AS rowcount', $conds, $fname, $options );
@@ -1530,23 +1531,23 @@
15311532 * $a may be either:
15321533 *
15331534 * - A single associative array. The array keys are the field names, and
1534 - * the values are the values to insert. The values are treated as data
1535 - * and will be quoted appropriately. If NULL is inserted, this will be
 1535+ * the values are the values to insert. The values are treated as data
 1536+ * and will be quoted appropriately. If NULL is inserted, this will be
15361537 * converted to a database NULL.
1537 - * - An array with numeric keys, holding a list of associative arrays.
 1538+ * - An array with numeric keys, holding a list of associative arrays.
15381539 * This causes a multi-row INSERT on DBMSs that support it. The keys in
15391540 * each subarray must be identical to each other, and in the same order.
15401541 *
1541 - * Usually throws a DBQueryError on failure. If errors are explicitly ignored,
 1542+ * Usually throws a DBQueryError on failure. If errors are explicitly ignored,
15421543 * returns success.
15431544 *
1544 - * $options is an array of options, with boolean options encoded as values
1545 - * with numeric keys, in the same style as $options in
 1545+ * $options is an array of options, with boolean options encoded as values
 1546+ * with numeric keys, in the same style as $options in
15461547 * DatabaseBase::select(). Supported options are:
15471548 *
1548 - * - IGNORE: Boolean: if present, duplicate key errors are ignored, and
1549 - * any rows which cause duplicate key errors are not inserted. It's
1550 - * possible to determine how many rows were successfully inserted using
 1549+ * - IGNORE: Boolean: if present, duplicate key errors are ignored, and
 1550+ * any rows which cause duplicate key errors are not inserted. It's
 1551+ * possible to determine how many rows were successfully inserted using
15511552 * DatabaseBase::affectedRows().
15521553 *
15531554 * @param $table String Table name. This will be passed through
@@ -1629,13 +1630,13 @@
16301631 * @param $table String name of the table to UPDATE. This will be passed through
16311632 * DatabaseBase::tableName().
16321633 *
1633 - * @param $values Array: An array of values to SET. For each array element,
 1634+ * @param $values Array: An array of values to SET. For each array element,
16341635 * the key gives the field name, and the value gives the data
1635 - * to set that field to. The data will be quoted by
 1636+ * to set that field to. The data will be quoted by
16361637 * DatabaseBase::addQuotes().
16371638 *
1638 - * @param $conds Array: An array of conditions (WHERE). See
1639 - * DatabaseBase::select() for the details of the format of
 1639+ * @param $conds Array: An array of conditions (WHERE). See
 1640+ * DatabaseBase::select() for the details of the format of
16401641 * condition arrays. Use '*' to update all rows.
16411642 *
16421643 * @param $fname String: The function name of the caller (from __METHOD__),
@@ -1663,7 +1664,7 @@
16641665 * @param $a Array containing the data
16651666 * @param $mode:
16661667 * - LIST_COMMA: comma separated, no field names
1667 - * - LIST_AND: ANDed WHERE clause (without the WHERE). See
 1668+ * - LIST_AND: ANDed WHERE clause (without the WHERE). See
16681669 * the documentation for $conds in DatabaseBase::select().
16691670 * - LIST_OR: ORed WHERE clause (without the WHERE)
16701671 * - LIST_SET: comma separated with field names, like a SET clause
@@ -2219,19 +2220,19 @@
22202221 *
22212222 * REPLACE is a very handy MySQL extension, which functions like an INSERT
22222223 * except that when there is a duplicate key error, the old row is deleted
2223 - * and the new row is inserted in its place.
 2224+ * and the new row is inserted in its place.
22242225 *
2225 - * We simulate this with standard SQL with a DELETE followed by INSERT. To
2226 - * perform the delete, we need to know what the unique indexes are so that
 2226+ * We simulate this with standard SQL with a DELETE followed by INSERT. To
 2227+ * perform the delete, we need to know what the unique indexes are so that
22272228 * we know how to find the conflicting rows.
22282229 *
2229 - * It may be more efficient to leave off unique indexes which are unlikely
2230 - * to collide. However if you do this, you run the risk of encountering
 2230+ * It may be more efficient to leave off unique indexes which are unlikely
 2231+ * to collide. However if you do this, you run the risk of encountering
22312232 * errors which wouldn't have occurred in MySQL.
2232 - *
2233 - * @param $rows Can be either a single row to insert, or multiple rows,
 2233+ *
 2234+ * @param $rows Can be either a single row to insert, or multiple rows,
22342235 * in the same format as for DatabaseBase::insert()
2235 - * @param $uniqueIndexes is an array of indexes. Each element may be either
 2236+ * @param $uniqueIndexes is an array of indexes. Each element may be either
22362237 * a field name or an array of field names
22372238 *
22382239 * @param $table String: The table to replace the row(s) in.
@@ -2321,10 +2322,10 @@
23222323 /**
23232324 * DELETE where the condition is a join.
23242325 *
2325 - * MySQL overrides this to use a multi-table DELETE syntax, in other databases
 2326+ * MySQL overrides this to use a multi-table DELETE syntax, in other databases
23262327 * we use sub-selects
23272328 *
2328 - * For safety, an empty $conds will not delete everything. If you want to
 2329+ * For safety, an empty $conds will not delete everything. If you want to
23292330 * delete all rows where the join condition matches, set $conds='*'.
23302331 *
23312332 * DO NOT put the join condition in $conds.
@@ -2333,16 +2334,16 @@
23342335 * @param $joinTable String: The other table.
23352336 * @param $delVar String: The variable to join on, in the first table.
23362337 * @param $joinVar String: The variable to join on, in the second table.
2337 - * @param $conds Array: Condition array of field names mapped to variables,
 2338+ * @param $conds Array: Condition array of field names mapped to variables,
23382339 * ANDed together in the WHERE clause
2339 - * @param $fname String: Calling function name (use __METHOD__) for
 2340+ * @param $fname String: Calling function name (use __METHOD__) for
23402341 * logs/profiling
23412342 */
2342 - function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds,
2343 - $fname = 'DatabaseBase::deleteJoin' )
 2343+ function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds,
 2344+ $fname = 'DatabaseBase::deleteJoin' )
23442345 {
23452346 if ( !$conds ) {
2346 - throw new DBUnexpectedError( $this,
 2347+ throw new DBUnexpectedError( $this,
23472348 'DatabaseBase::deleteJoin() called with empty $conds' );
23482349 }
23492350
@@ -2382,7 +2383,7 @@
23832384 * MySQL's LOW_PRIORITY. If no such feature exists, return an empty
23842385 * string and nothing bad should happen.
23852386 *
2386 - * @return string Returns the text of the low priority option if it is
 2387+ * @return string Returns the text of the low priority option if it is
23872388 * supported, or a blank string otherwise
23882389 */
23892390 function lowPriorityOption() {
@@ -2422,25 +2423,25 @@
24232424 * @param $srcTable May be either a table name, or an array of table names
24242425 * to include in a join.
24252426 *
2426 - * @param $varMap must be an associative array of the form
2427 - * array( 'dest1' => 'source1', ...). Source items may be literals
2428 - * rather than field names, but strings should be quoted with
 2427+ * @param $varMap must be an associative array of the form
 2428+ * array( 'dest1' => 'source1', ...). Source items may be literals
 2429+ * rather than field names, but strings should be quoted with
24292430 * DatabaseBase::addQuotes()
24302431 *
2431 - * @param $conds Condition array. See $conds in DatabaseBase::select() for
2432 - * the details of the format of condition arrays. May be "*" to copy the
 2432+ * @param $conds Condition array. See $conds in DatabaseBase::select() for
 2433+ * the details of the format of condition arrays. May be "*" to copy the
24332434 * whole table.
24342435 *
24352436 * @param $fname The function name of the caller, from __METHOD__
24362437 *
2437 - * @param $insertOptions Options for the INSERT part of the query, see
 2438+ * @param $insertOptions Options for the INSERT part of the query, see
24382439 * DatabaseBase::insert() for details.
24392440 * @param $selectOptions Options for the SELECT part of the query, see
24402441 * DatabaseBase::select() for details.
24412442 *
24422443 * @return ResultWrapper
24432444 */
2444 - function insertSelect( $destTable, $srcTable, $varMap, $conds,
 2445+ function insertSelect( $destTable, $srcTable, $varMap, $conds,
24452446 $fname = 'DatabaseBase::insertSelect',
24462447 $insertOptions = array(), $selectOptions = array() )
24472448 {
@@ -2652,11 +2653,11 @@
26532654 * Wait for the slave to catch up to a given master position.
26542655 *
26552656 * @param $pos DBMasterPos object
2656 - * @param $timeout Integer: the maximum number of seconds to wait for
 2657+ * @param $timeout Integer: the maximum number of seconds to wait for
26572658 * synchronisation
26582659 *
26592660 * @return An integer: zero if the slave was past that position already,
2660 - * greater than zero if we waited for some period of time, less than
 2661+ * greater than zero if we waited for some period of time, less than
26612662 * zero if we timed out.
26622663 */
26632664 function masterPosWait( DBMasterPos $pos, $timeout ) {
@@ -2760,10 +2761,10 @@
27612762 * @param $fname String: calling function name
27622763 * @return Boolean: true if operation was successful
27632764 */
2764 - function duplicateTableStructure( $oldName, $newName, $temporary = false,
2765 - $fname = 'DatabaseBase::duplicateTableStructure' )
 2765+ function duplicateTableStructure( $oldName, $newName, $temporary = false,
 2766+ $fname = 'DatabaseBase::duplicateTableStructure' )
27662767 {
2767 - throw new MWException(
 2768+ throw new MWException(
27682769 'DatabaseBase::duplicateTableStructure is not implemented in descendant class' );
27692770 }
27702771
@@ -2778,10 +2779,10 @@
27792780 }
27802781
27812782 /**
2782 - * Convert a timestamp in one of the formats accepted by wfTimestamp()
 2783+ * Convert a timestamp in one of the formats accepted by wfTimestamp()
27832784 * to the format used for inserting into timestamp fields in this DBMS.
27842785 *
2785 - * The result is unquoted, and needs to be passed through addQuotes()
 2786+ * The result is unquoted, and needs to be passed through addQuotes()
27862787 * before it can be included in raw SQL.
27872788 *
27882789 * @return string
@@ -2791,12 +2792,12 @@
27922793 }
27932794
27942795 /**
2795 - * Convert a timestamp in one of the formats accepted by wfTimestamp()
2796 - * to the format used for inserting into timestamp fields in this DBMS. If
2797 - * NULL is input, it is passed through, allowing NULL values to be inserted
 2796+ * Convert a timestamp in one of the formats accepted by wfTimestamp()
 2797+ * to the format used for inserting into timestamp fields in this DBMS. If
 2798+ * NULL is input, it is passed through, allowing NULL values to be inserted
27982799 * into timestamp fields.
27992800 *
2800 - * The result is unquoted, and needs to be passed through addQuotes()
 2801+ * The result is unquoted, and needs to be passed through addQuotes()
28012802 * before it can be included in raw SQL.
28022803 *
28032804 * @return string
@@ -2810,14 +2811,14 @@
28112812 }
28122813
28132814 /**
2814 - * Take the result from a query, and wrap it in a ResultWrapper if
2815 - * necessary. Boolean values are passed through as is, to indicate success
2816 - * of write queries or failure.
 2815+ * Take the result from a query, and wrap it in a ResultWrapper if
 2816+ * necessary. Boolean values are passed through as is, to indicate success
 2817+ * of write queries or failure.
28172818 *
2818 - * Once upon a time, DatabaseBase::query() returned a bare MySQL result
 2819+ * Once upon a time, DatabaseBase::query() returned a bare MySQL result
28192820 * resource, and it was necessary to call this function to convert it to
28202821 * a wrapper. Nowadays, raw database objects are never exposed to external
2821 - * callers, so this is unnecessary in external code. For compatibility with
 2822+ * callers, so this is unnecessary in external code. For compatibility with
28222823 * old code, ResultWrapper objects are passed through unaltered.
28232824 */
28242825 function resultObject( $result ) {
@@ -2869,10 +2870,10 @@
28702871 }
28712872
28722873 /**
2873 - * Some DBMSs have a special format for inserting into blob fields, they
2874 - * don't allow simple quoted strings to be inserted. To insert into such
2875 - * a field, pass the data through this function before passing it to
2876 - * DatabaseBase::insert().
 2874+ * Some DBMSs have a special format for inserting into blob fields, they
 2875+ * don't allow simple quoted strings to be inserted. To insert into such
 2876+ * a field, pass the data through this function before passing it to
 2877+ * DatabaseBase::insert().
28772878 */
28782879 function encodeBlob( $b ) {
28792880 return $b;
@@ -2880,7 +2881,7 @@
28812882
28822883 /**
28832884 * Some DBMSs return a special placeholder object representing blob fields
2884 - * in result objects. Pass the object through this function to return the
 2885+ * in result objects. Pass the object through this function to return the
28852886 * original string.
28862887 */
28872888 function decodeBlob( $b ) {
@@ -2900,13 +2901,13 @@
29012902 /**
29022903 * Read and execute SQL commands from a file.
29032904 *
2904 - * Returns true on success, error string or exception on failure (depending
 2905+ * Returns true on success, error string or exception on failure (depending
29052906 * on object's error ignore settings).
29062907 *
29072908 * @param $filename String: File name to open
29082909 * @param $lineCallback Callback: Optional function called before reading each line
29092910 * @param $resultCallback Callback: Optional function called for each MySQL result
2910 - * @param $fname String: Calling function name or false if name should be
 2911+ * @param $fname String: Calling function name or false if name should be
29112912 * generated dynamically using $filename
29122913 */
29132914 function sourceFile( $filename, $lineCallback = false, $resultCallback = false, $fname = false ) {
@@ -2968,7 +2969,7 @@
29692970 /**
29702971 * Read and execute commands from an open file handle.
29712972 *
2972 - * Returns true on success, error string or exception on failure (depending
 2973+ * Returns true on success, error string or exception on failure (depending
29732974 * on object's error ignore settings).
29742975 *
29752976 * @param $fp Resource: File handle
@@ -2976,8 +2977,8 @@
29772978 * @param $resultCallback Callback: Optional function called for each MySQL result
29782979 * @param $fname String: Calling function name
29792980 */
2980 - function sourceStream( $fp, $lineCallback = false, $resultCallback = false,
2981 - $fname = 'DatabaseBase::sourceStream' )
 2981+ function sourceStream( $fp, $lineCallback = false, $resultCallback = false,
 2982+ $fname = 'DatabaseBase::sourceStream' )
29822983 {
29832984 $cmd = "";
29842985 $done = false;
@@ -3050,12 +3051,12 @@
30513052 *
30523053 * Supports '{$var}' `{$var}` and / *$var* / (without the spaces) style variables.
30533054 *
3054 - * - '{$var}' should be used for text and is passed through the database's
 3055+ * - '{$var}' should be used for text and is passed through the database's
30553056 * addQuotes method.
3056 - * - `{$var}` should be used for identifiers (eg: table and database names),
3057 - * it is passed through the database's addIdentifierQuotes method which
 3057+ * - `{$var}` should be used for identifiers (eg: table and database names),
 3058+ * it is passed through the database's addIdentifierQuotes method which
30583059 * can be overridden if the database uses something other than backticks.
3059 - * - / *$var* / is just encoded, besides traditional table prefix and
 3060+ * - / *$var* / is just encoded, besides traditional table prefix and
30603061 * table options its use should be avoided.
30613062 *
30623063 * @param $ins String: SQL statement to replace variables in
@@ -3076,6 +3077,10 @@
30773078
30783079 /**
30793080 * Replace variables in sourced SQL
 3081+ *
 3082+ * @param $ins string
 3083+ *
 3084+ * @return string
30803085 */
30813086 protected function replaceVars( $ins ) {
30823087 $ins = $this->replaceSchemaVars( $ins );
@@ -3108,6 +3113,8 @@
31093114 *
31103115 * Override this in derived classes to provide variables for tables.sql
31113116 * and SQL patch files.
 3117+ *
 3118+ * @return array
31123119 */
31133120 protected function getDefaultSchemaVars() {
31143121 return array();
@@ -3115,7 +3122,10 @@
31163123
31173124 /**
31183125 * Table name callback
3119 - * @private
 3126+ *
 3127+ * @param $matches array
 3128+ *
 3129+ * @return string
31203130 */
31213131 protected function tableNameCallback( $matches ) {
31223132 return $this->tableName( $matches[1] );
@@ -3123,6 +3133,10 @@
31243134
31253135 /**
31263136 * Index name callback
 3137+ *
 3138+ * @param $matches array
 3139+ *
 3140+ * @return string
31273141 */
31283142 protected function indexNameCallback( $matches ) {
31293143 return $this->indexName( $matches[1] );
@@ -3173,6 +3187,8 @@
31743188 * @param $write Array of tables to lock for write access
31753189 * @param $method String name of caller
31763190 * @param $lowPriority bool Whether to indicate writes to be LOW PRIORITY
 3191+ *
 3192+ * @return bool
31773193 */
31783194 public function lockTables( $read, $write, $method, $lowPriority = true ) {
31793195 return true;
@@ -3182,6 +3198,8 @@
31833199 * Unlock specific tables
31843200 *
31853201 * @param $method String the caller
 3202+ *
 3203+ * @return bool
31863204 */
31873205 public function unlockTables( $method ) {
31883206 return true;
@@ -3189,6 +3207,9 @@
31903208
31913209 /**
31923210 * Delete a table
 3211+ * @param $tableName string
 3212+ * @param $fName string
 3213+ * @return bool|ResultWrapper
31933214 */
31943215 public function dropTable( $tableName, $fName = 'DatabaseBase::dropTable' ) {
31953216 if( !$this->tableExists( $tableName ) ) {
@@ -3242,7 +3263,7 @@
32433264 *
32443265 * This is a MySQL-specific feature.
32453266 *
3246 - * @param $value Mixed: true for allow, false for deny, or "default" to
 3267+ * @param $value Mixed: true for allow, false for deny, or "default" to
32473268 * restore the initial value
32483269 */
32493270 public function setBigSelects( $value = true ) {

Status & tagging log