r62040 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62039‎ | r62040 | r62041 >
Date:18:28, 5 February 2010
Author:ialex
Status:ok
Tags:
Comment:
Fix doxygen warnings
Modified paths:
  • /trunk/phase3/includes/db/DatabaseIbm_db2.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseIbm_db2.php
@@ -21,9 +21,9 @@
2222
2323 /**
2424 * Builder method for the class
25 - * @param DatabaseIbm_db2 $db Database interface
26 - * @param string $table table name
27 - * @param string $field column name
 25+ * @param $db DatabaseIbm_db2: Database interface
 26+ * @param $table String: table name
 27+ * @param $field String: column name
2828 * @return IBM_DB2Field
2929 */
3030 static function fromText($db, $table, $field) {
@@ -403,12 +403,13 @@
404404
405405 /**
406406 *
407 - * @param string $server hostname of database server
408 - * @param string $user username
409 - * @param string $password
410 - * @param string $dbName database name on the server
411 - * @param function $failFunction (optional)
412 - * @param integer $flags database behaviour flags (optional, unused)
 407+ * @param $server String: hostname of database server
 408+ * @param $user String: username
 409+ * @param $password String: password
 410+ * @param $dbName String: database name on the server
 411+ * @param $failFunction Callback (optional)
 412+ * @param $flags Integer: database behaviour flags (optional, unused)
 413+ * @param $schema String
413414 */
414415 public function DatabaseIbm_db2($server = false, $user = false, $password = false,
415416 $dbName = false, $failFunction = false, $flags = 0,
@@ -441,9 +442,9 @@
442443
443444 /**
444445 * Enables options only if the ibm_db2 extension version supports them
445 - * @param string $name Name of the option in the options array
446 - * @param string $const Name of the constant holding the right option value
447 - * @param int $type Whether this is a Connection or Statement otion
 446+ * @param $name String: name of the option in the options array
 447+ * @param $const String: name of the constant holding the right option value
 448+ * @param $type Integer: whether this is a Connection or Statement otion
448449 */
449450 private function setDB2Option($name, $const, $type) {
450451 if (defined($const)) {
@@ -457,7 +458,7 @@
458459
459460 /**
460461 * Outputs debug information in the appropriate place
461 - * @param string $string The relevant debug message
 462+ * @param $string String: the relevant debug message
462463 */
463464 private function installPrint($string) {
464465 wfDebug("$string");
@@ -471,10 +472,10 @@
472473 * Opens a database connection and returns it
473474 * Closes any existing connection
474475 * @return a fresh connection
475 - * @param string $server hostname
476 - * @param string $user
477 - * @param string $password
478 - * @param string $dbName database name
 476+ * @param $server String: hostname
 477+ * @param $user String
 478+ * @param $password String
 479+ * @param $dbName String: database name
479480 */
480481 public function open( $server, $user, $password, $dbName )
481482 {
@@ -576,14 +577,14 @@
577578
578579 /**
579580 * Returns a fresh instance of this class
580 - * @static
581 - * @return
582 - * @param string $server hostname of database server
583 - * @param string $user username
584 - * @param string $password
585 - * @param string $dbName database name on the server
586 - * @param function $failFunction (optional)
587 - * @param integer $flags database behaviour flags (optional, unused)
 581+ *
 582+ * @param $server String: hostname of database server
 583+ * @param $user String: username
 584+ * @param $password String
 585+ * @param $dbName String: database name on the server
 586+ * @param $failFunction Callback (optional)
 587+ * @param $flags Integer: database behaviour flags (optional, unused)
 588+ * @return DatabaseIbm_db2 object
588589 */
589590 static function newFromParams( $server, $user, $password, $dbName, $failFunction = false, $flags = 0)
590591 {
@@ -769,7 +770,7 @@
770771 /**
771772 * Escapes strings
772773 * Doesn't escape numbers
773 - * @param string s string to escape
 774+ * @param $s String: string to escape
774775 * @return escaped string
775776 */
776777 public function addQuotes( $s ) {
@@ -793,7 +794,7 @@
794795 /**
795796 * Verifies that a DB2 column/field type is numeric
796797 * @return bool true if numeric
797 - * @param string $type DB2 column type
 798+ * @param $type String: DB2 column type
798799 */
799800 public function is_numeric_type( $type ) {
800801 switch (strtoupper($type)) {
@@ -812,7 +813,7 @@
813814
814815 /**
815816 * Alias for addQuotes()
816 - * @param string s string to escape
 817+ * @param $s String: string to escape
817818 * @return escaped string
818819 */
819820 public function strencode( $s ) {
@@ -946,9 +947,9 @@
947948 /**
948949 * Construct a LIMIT query with optional offset
949950 * This is used for query pages
950 - * $sql string SQL query we will append the limit too
951 - * $limit integer the SQL limit
952 - * $offset integer the SQL offset (default false)
 951+ * @param $sql string SQL query we will append the limit too
 952+ * @param $limit integer the SQL limit
 953+ * @param $offset integer the SQL offset (default false)
953954 */
954955 public function limitResult($sql, $limit, $offset=false) {
955956 if( !is_numeric($limit) ) {
@@ -984,7 +985,7 @@
985986 /**
986987 * Generates a timestamp in an insertable format
987988 * @return string timestamp value
988 - * @param timestamp $ts
 989+ * @param $ts timestamp
989990 */
990991 public function timestamp( $ts=0 ) {
991992 // TS_MW cannot be easily distinguished from an integer
@@ -993,7 +994,7 @@
994995
995996 /**
996997 * Return the next in a sequence, save the value for retrieval via insertId()
997 - * @param string seqName Name of a defined sequence in the database
 998+ * @param $seqName String: name of a defined sequence in the database
998999 * @return next value in that sequence
9991000 */
10001001 public function nextSequenceValue( $seqName ) {
@@ -1020,9 +1021,9 @@
10211022
10221023 /**
10231024 * Updates the mInsertId property with the value of the last insert into a generated column
1024 - * @param string $table Sanitized table name
1025 - * @param mixed $primaryKey String name of the primary key or a bool if this call is a do-nothing
1026 - * @param resource $stmt Prepared statement resource
 1025+ * @param $table String: sanitized table name
 1026+ * @param $primaryKey Mixed: string name of the primary key or a bool if this call is a do-nothing
 1027+ * @param $stmt Resource: prepared statement resource
10271028 * of the SELECT primary_key FROM FINAL TABLE ( INSERT ... ) form
10281029 */
10291030 private function calcInsertId($table, $primaryKey, $stmt) {
@@ -1038,10 +1039,10 @@
10391040 * $args may be a single associative array, or an array of these with numeric keys,
10401041 * for multi-row insert
10411042 *
1042 - * @param array $table String: Name of the table to insert to.
1043 - * @param array $args Array: Items to insert into the table.
1044 - * @param array $fname String: Name of the function, for profiling
1045 - * @param mixed $options String or Array. Valid options: IGNORE
 1043+ * @param $table String: Name of the table to insert to.
 1044+ * @param $args Array: Items to insert into the table.
 1045+ * @param $fname String: Name of the function, for profiling
 1046+ * @param $options String or Array. Valid options: IGNORE
10461047 *
10471048 * @return bool Success of insert operation. IGNORE always returns true.
10481049 */
@@ -1150,9 +1151,9 @@
11511152 * Given a table name and a hash of columns with values
11521153 * Removes primary key columns from the hash where the value is NULL
11531154 *
1154 - * @param string $table Name of the table
1155 - * @param array $args Array of hashes of column names with values
1156 - * @return array Tuple containing filtered array of columns, array of primary keys
 1155+ * @param $table String: name of the table
 1156+ * @param $args Array of hashes of column names with values
 1157+ * @return Array: tuple containing filtered array of columns, array of primary keys
11571158 */
11581159 private function removeNullPrimaryKeys($table, $args) {
11591160 $schema = $this->mSchema;
@@ -1178,14 +1179,14 @@
11791180 /**
11801181 * UPDATE wrapper, takes a condition array and a SET array
11811182 *
1182 - * @param string $table The table to UPDATE
1183 - * @param array $values An array of values to SET
1184 - * @param array $conds An array of conditions (WHERE). Use '*' to update all rows.
1185 - * @param string $fname The Class::Function calling this function
1186 - * (for the log)
1187 - * @param array $options An array of UPDATE options, can be one or
1188 - * more of IGNORE, LOW_PRIORITY
1189 - * @return bool
 1183+ * @param $table String: The table to UPDATE
 1184+ * @param $values An array of values to SET
 1185+ * @param $conds An array of conditions (WHERE). Use '*' to update all rows.
 1186+ * @param $fname String: The Class::Function calling this function
 1187+ * (for the log)
 1188+ * @param $options An array of UPDATE options, can be one or
 1189+ * more of IGNORE, LOW_PRIORITY
 1190+ * @return Boolean
11901191 */
11911192 public function update( $table, $values, $conds, $fname = 'Database::update', $options = array() ) {
11921193 $table = $this->tableName( $table );
@@ -1216,7 +1217,7 @@
12171218
12181219 /**
12191220 * Returns the number of rows affected by the last query or 0
1220 - * @return int the number of rows affected by the last query
 1221+ * @return Integer: the number of rows affected by the last query
12211222 */
12221223 public function affectedRows() {
12231224 if ( !is_null( $this->mAffectedRows ) ) {
@@ -1231,9 +1232,9 @@
12321233 /**
12331234 * Simulates REPLACE with a DELETE followed by INSERT
12341235 * @param $table Object
1235 - * @param array $uniqueIndexes array consisting of indexes and arrays of indexes
1236 - * @param array $rows Rows to insert
1237 - * @param string $fname Name of the function for profiling
 1236+ * @param $uniqueIndexes Array consisting of indexes and arrays of indexes
 1237+ * @param $rows Array: rows to insert
 1238+ * @param $fname String: name of the function for profiling
12381239 * @return nothing
12391240 */
12401241 function replace( $table, $uniqueIndexes, $rows, $fname = 'DatabaseIbm_db2::replace' ) {
@@ -1288,8 +1289,8 @@
12891290 /**
12901291 * Returns the number of rows in the result set
12911292 * Has to be called right after the corresponding select query
1292 - * @param object $res result set
1293 - * @return int number of rows
 1293+ * @param $res Object result set
 1294+ * @return Integer: number of rows
12941295 */
12951296 public function numRows( $res ) {
12961297 if ( $res instanceof ResultWrapper ) {
@@ -1305,8 +1306,8 @@
13061307
13071308 /**
13081309 * Moves the row pointer of the result set
1309 - * @param object $res result set
1310 - * @param int $row row number
 1310+ * @param $res Object: result set
 1311+ * @param $row Integer: row number
13111312 * @return success or failure
13121313 */
13131314 public function dataSeek( $res, $row ) {
@@ -1322,8 +1323,8 @@
13231324
13241325 /**
13251326 * Frees memory associated with a statement resource
1326 - * @param object $res Statement resource to free
1327 - * @return bool success or failure
 1327+ * @param $res Object: statement resource to free
 1328+ * @return Boolean success or failure
13281329 */
13291330 public function freeResult( $res ) {
13301331 if ( $res instanceof ResultWrapper ) {
@@ -1336,7 +1337,7 @@
13371338
13381339 /**
13391340 * Returns the number of columns in a resource
1340 - * @param object $res Statement resource
 1341+ * @param $res Object: statement resource
13411342 * @return Number of fields/columns in resource
13421343 */
13431344 public function numFields( $res ) {
@@ -1348,9 +1349,9 @@
13491350
13501351 /**
13511352 * Returns the nth column name
1352 - * @param object $res Statement resource
1353 - * @param int $n Index of field or column
1354 - * @return string name of nth column
 1353+ * @param $res Object: statement resource
 1354+ * @param $n Integer: Index of field or column
 1355+ * @return String name of nth column
13551356 */
13561357 public function fieldName( $res, $n ) {
13571358 if ( $res instanceof ResultWrapper ) {
@@ -1362,15 +1363,15 @@
13631364 /**
13641365 * SELECT wrapper
13651366 *
1366 - * @param mixed $table Array or string, table name(s) (prefix auto-added)
1367 - * @param mixed $vars Array or string, field name(s) to be retrieved
1368 - * @param mixed $conds Array or string, condition(s) for WHERE
1369 - * @param string $fname Calling function name (use __METHOD__) for logs/profiling
1370 - * @param array $options Associative array of options (e.g. array('GROUP BY' => 'page_title')),
1371 - * see Database::makeSelectOptions code for list of supported stuff
1372 - * @param array $join_conds Associative array of table join conditions (optional)
1373 - * (e.g. array( 'page' => array('LEFT JOIN','page_latest=rev_id') )
1374 - * @return mixed Database result resource (feed to Database::fetchObject or whatever), or false on failure
 1367+ * @param $table Array or string, table name(s) (prefix auto-added)
 1368+ * @param $vars Array or string, field name(s) to be retrieved
 1369+ * @param $conds Array or string, condition(s) for WHERE
 1370+ * @param $fname String: calling function name (use __METHOD__) for logs/profiling
 1371+ * @param $options Associative array of options (e.g. array('GROUP BY' => 'page_title')),
 1372+ * see Database::makeSelectOptions code for list of supported stuff
 1373+ * @param $join_conds Associative array of table join conditions (optional)
 1374+ * (e.g. array( 'page' => array('LEFT JOIN','page_latest=rev_id') )
 1375+ * @return Mixed: database result resource (feed to Database::fetchObject or whatever), or false on failure
13751376 */
13761377 public function select( $table, $vars, $conds='', $fname = 'DatabaseIbm_db2::select', $options = array(), $join_conds = array() )
13771378 {
@@ -1411,9 +1412,9 @@
14121413 *
14131414 * @private
14141415 *
1415 - * @param array $options an associative array of options to be turned into
 1416+ * @param $options Associative array of options to be turned into
14161417 * an SQL query, valid keys are listed in the function.
1417 - * @return array
 1418+ * @return Array
14181419 */
14191420 function makeSelectOptions( $options ) {
14201421 $preLimitTail = $postLimitTail = '';
@@ -1447,7 +1448,7 @@
14481449 * Get search engine class. All subclasses of this
14491450 * need to implement this if they wish to use searching.
14501451 *
1451 - * @return string
 1452+ * @return String
14521453 */
14531454 public function getSearchEngine() {
14541455 return "SearchIBM_DB2";
@@ -1455,7 +1456,7 @@
14561457
14571458 /**
14581459 * Did the last database access fail because of deadlock?
1459 - * @return bool
 1460+ * @return Boolean
14601461 */
14611462 public function wasDeadlock() {
14621463 // get SQLSTATE
@@ -1473,7 +1474,7 @@
14741475 /**
14751476 * Ping the server and try to reconnect if it there is no connection
14761477 * The connection may be closed and reopened while this happens
1477 - * @return bool whether the connection exists
 1478+ * @return Boolean: whether the connection exists
14781479 */
14791480 public function ping() {
14801481 // db2_ping() doesn't exist
@@ -1533,9 +1534,9 @@
15341535
15351536 /**
15361537 * Query whether a given column exists in the mediawiki schema
1537 - * @param string $table name of the table
1538 - * @param string $field name of the column
1539 - * @param string $fname function name for logging and profiling
 1538+ * @param $table String: name of the table
 1539+ * @param $field String: name of the column
 1540+ * @param $fname String: function name for logging and profiling
15401541 */
15411542 public function fieldExists( $table, $field, $fname = 'DatabaseIbm_db2::fieldExists' ) {
15421543 $table = $this->tableName( $table );
@@ -1558,10 +1559,10 @@
15591560 /**
15601561 * Returns information about an index
15611562 * If errors are explicitly ignored, returns NULL on failure
1562 - * @param string $table table name
1563 - * @param string $index index name
1564 - * @param string
1565 - * @return object query row in object form
 1563+ * @param $table String: table name
 1564+ * @param $index String: index name
 1565+ * @param $fname String: function name for logging and profiling
 1566+ * @return Object query row in object form
15661567 */
15671568 public function indexInfo( $table, $index, $fname = 'DatabaseIbm_db2::indexExists' ) {
15681569 $table = $this->tableName( $table );
@@ -1581,8 +1582,8 @@
15821583
15831584 /**
15841585 * Returns an information object on a table column
1585 - * @param string $table table name
1586 - * @param string $field column name
 1586+ * @param $table String: table name
 1587+ * @param $field String: column name
15871588 * @return IBM_DB2Field
15881589 */
15891590 public function fieldInfo( $table, $field ) {
@@ -1591,9 +1592,9 @@
15921593
15931594 /**
15941595 * db2_field_type() wrapper
1595 - * @param object $res Result of executed statement
1596 - * @param mixed $index number or name of the column
1597 - * @return string column type
 1596+ * @param $res Object: result of executed statement
 1597+ * @param $index Mixed: number or name of the column
 1598+ * @return String column type
15981599 */
15991600 public function fieldType( $res, $index ) {
16001601 if ( $res instanceof ResultWrapper ) {
@@ -1604,10 +1605,10 @@
16051606
16061607 /**
16071608 * Verifies that an index was created as unique
1608 - * @param string $table table name
1609 - * @param string $index index name
1610 - * @param string $fnam function name for profiling
1611 - * @return bool
 1609+ * @param $table String: table name
 1610+ * @param $index String: index name
 1611+ * @param $fname function name for profiling
 1612+ * @return Bool
16121613 */
16131614 public function indexUnique ($table, $index, $fname = 'Database::indexUnique' ) {
16141615 $table = $this->tableName( $table );
@@ -1630,9 +1631,9 @@
16311632
16321633 /**
16331634 * Returns the size of a text field, or -1 for "unlimited"
1634 - * @param string $table table name
1635 - * @param string $field column name
1636 - * @return int length or -1 for unlimited
 1635+ * @param $table String: table name
 1636+ * @param $field String: column name
 1637+ * @return Integer: length or -1 for unlimited
16371638 */
16381639 public function textFieldSize( $table, $field ) {
16391640 $table = $this->tableName( $table );
@@ -1650,12 +1651,12 @@
16511652
16521653 /**
16531654 * DELETE where the condition is a join
1654 - * @param string $delTable deleting from this table
1655 - * @param string $joinTable using data from this table
1656 - * @param string $delVar variable in deleteable table
1657 - * @param string $joinVar variable in data table
1658 - * @param array $conds conditionals for join table
1659 - * @param string $fname function name for profiling
 1655+ * @param $delTable String: deleting from this table
 1656+ * @param $joinTable String: using data from this table
 1657+ * @param $delVar String: variable in deleteable table
 1658+ * @param $joinVar String: variable in data table
 1659+ * @param $conds Array: conditionals for join table
 1660+ * @param $fname String: function name for profiling
16601661 */
16611662 public function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = "DatabaseIbm_db2::deleteJoin" ) {
16621663 if ( !$conds ) {
@@ -1675,7 +1676,7 @@
16761677
16771678 /**
16781679 * Description is left as an exercise for the reader
1679 - * @param mixed $b data to be encoded
 1680+ * @param $b Mixed: data to be encoded
16801681 * @return IBM_DB2Blob
16811682 */
16821683 public function encodeBlob($b) {
@@ -1684,7 +1685,7 @@
16851686
16861687 /**
16871688 * Description is left as an exercise for the reader
1688 - * @param IBM_DB2Blob $b data to be decoded
 1689+ * @param $b IBM_DB2Blob: data to be decoded
16891690 * @return mixed
16901691 */
16911692 public function decodeBlob($b) {
@@ -1693,8 +1694,8 @@
16941695
16951696 /**
16961697 * Convert into a list of string being concatenated
1697 - * @param array $stringList strings that need to be joined together by the SQL engine
1698 - * @return string joined by the concatenation operator
 1698+ * @param $stringList Array: strings that need to be joined together by the SQL engine
 1699+ * @return String: joined by the concatenation operator
16991700 */
17001701 public function buildConcat( $stringList ) {
17011702 // || is equivalent to CONCAT
@@ -1704,8 +1705,8 @@
17051706
17061707 /**
17071708 * Generates the SQL required to convert a DB2 timestamp into a Unix epoch
1708 - * @param string $column name of timestamp column
1709 - * @return string SQL code
 1709+ * @param $column String: name of timestamp column
 1710+ * @return String: SQL code
17101711 */
17111712 public function extractUnixEpoch( $column ) {
17121713 // TODO
@@ -1724,7 +1725,8 @@
17251726 * ! = raw SQL bit (a function for instance)
17261727 * & = filename; reads the file and inserts as a blob
17271728 * (we don't use this though...)
1728 - * @param string $sql SQL statement with appropriate markers
 1729+ * @param $sql String: SQL statement with appropriate markers
 1730+ * @param $func String: Name of the function, for profiling
17291731 * @return resource a prepared DB2 SQL statement
17301732 */
17311733 public function prepare( $sql, $func = 'DB2::prepare' ) {
@@ -1734,7 +1736,7 @@
17351737
17361738 /**
17371739 * Frees resources associated with a prepared statement
1738 - * @return bool success or failure
 1740+ * @return Boolean success or failure
17391741 */
17401742 public function freePrepared( $prepared ) {
17411743 return db2_free_stmt($prepared);
@@ -1742,9 +1744,9 @@
17431745
17441746 /**
17451747 * Execute a prepared query with the various arguments
1746 - * @param string $prepared the prepared sql
1747 - * @param mixed $args Either an array here, or put scalars as varargs
1748 - * @return resource Results object
 1748+ * @param $prepared String: the prepared sql
 1749+ * @param $args Mixed: either an array here, or put scalars as varargs
 1750+ * @return Resource: results object
17491751 */
17501752 public function execute( $prepared, $args = null ) {
17511753 if( !is_array( $args ) ) {
@@ -1778,9 +1780,9 @@
17791781 /**
17801782 * For faking prepared SQL statements on DBs that don't support
17811783 * it directly.
1782 - * @param resource $preparedQuery String: a 'preparable' SQL statement
1783 - * @param array $args Array of arguments to fill it with
1784 - * @return string executable statement
 1784+ * @param $preparedQuery String: a 'preparable' SQL statement
 1785+ * @param $args Array of arguments to fill it with
 1786+ * @return String: executable statement
17851787 */
17861788 public function fillPrepared( $preparedQuery, $args ) {
17871789 reset( $args );
@@ -1805,8 +1807,8 @@
18061808 /**
18071809 * Bitwise negation of a column or value in SQL
18081810 * Same as (~field) in C
1809 - * @param string $field
1810 - * @return string
 1811+ * @param $field String
 1812+ * @return String
18111813 */
18121814 function bitNot($field) {
18131815 //expecting bit-fields smaller than 4bytes
@@ -1816,9 +1818,9 @@
18171819 /**
18181820 * Bitwise AND of two columns or values in SQL
18191821 * Same as (fieldLeft & fieldRight) in C
1820 - * @param string $fieldLeft
1821 - * @param string $fieldRight
1822 - * @return string
 1822+ * @param $fieldLeft String
 1823+ * @param $fieldRight String
 1824+ * @return String
18231825 */
18241826 function bitAnd($fieldLeft, $fieldRight) {
18251827 return 'BITAND('.$fieldLeft.', '.$fieldRight.')';
@@ -1827,9 +1829,9 @@
18281830 /**
18291831 * Bitwise OR of two columns or values in SQL
18301832 * Same as (fieldLeft | fieldRight) in C
1831 - * @param string $fieldLeft
1832 - * @param string $fieldRight
1833 - * @return string
 1833+ * @param $fieldLeft String
 1834+ * @param $fieldRight String
 1835+ * @return String
18341836 */
18351837 function bitOr($fieldLeft, $fieldRight) {
18361838 return 'BITOR('.$fieldLeft.', '.$fieldRight.')';

Status & tagging log