r21359 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r21358‎ | r21359 | r21360 >
Date:02:01, 19 April 2007
Author:simetrical
Status:old
Tags:
Comment:
Documentation, mark public functions public, comment a presumably private function as private
Modified paths:
  • /trunk/phase3/includes/Database.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Database.php
@@ -655,10 +655,15 @@
656656 }
657657
658658 /**
659 - * Usually aborts on failure
660 - * If errors are explicitly ignored, returns success
 659+ * Usually aborts on failure. If errors are explicitly ignored, returns success.
 660+ *
 661+ * @param $sql String: SQL query
 662+ * @param $fname String: Name of the calling function, for profiling/SHOW PROCESSLIST comment (you can use __METHOD__ or add some extra info)
 663+ * @param $tempIgnore Bool: Whether to avoid throwing an exception on errors... maybe best to catch the exception instead?
 664+ * @return Result object to feed to fetchObject, fetchRow, ...; or false on failure if $tempIgnore set
 665+ * @throws DBQueryError Thrown when the database returns an error of any kind
661666 */
662 - function query( $sql, $fname = '', $tempIgnore = false ) {
 667+ public function query( $sql, $fname = '', $tempIgnore = false ) {
663668 global $wgProfiling;
664669
665670 if ( $wgProfiling ) {
@@ -735,9 +740,11 @@
736741
737742 /**
738743 * The DBMS-dependent part of query()
739 - * @param string $sql SQL query.
 744+ * @param $sql String: SQL query.
 745+ * @return Result object to feed to fetchObject, fetchRow, ...; or false on failure
 746+ * @access private
740747 */
741 - function doQuery( $sql ) {
 748+ /*private*/ function doQuery( $sql ) {
742749 if( $this->bufferResults() ) {
743750 $ret = mysql_query( $sql, $this->mConn );
744751 } else {
@@ -878,7 +885,13 @@
879886 }
880887
881888 /**
882 - * Fetch the next row from the given result object, in object form
 889+ * Fetch the next row from the given result object, in object form.
 890+ * Fields can be retrieved with $row->fieldname, with fields acting like
 891+ * member variables.
 892+ *
 893+ * @param $res SQL result object as returned from Database::query(), etc.
 894+ * @return MySQL row object
 895+ * @throws DBUnexpectedError Thrown if the database returns an error
883896 */
884897 function fetchObject( $res ) {
885898 @/**/$row = mysql_fetch_object( $res );
@@ -889,8 +902,12 @@
890903 }
891904
892905 /**
893 - * Fetch the next row from the given result object
894 - * Returns an array
 906+ * Fetch the next row from the given result object, in associative array
 907+ * form. Fields are retrieved with $row['fieldname'].
 908+ *
 909+ * @param $res SQL result object as returned from Database::query(), etc.
 910+ * @return MySQL row object
 911+ * @throws DBUnexpectedError Thrown if the database returns an error
895912 */
896913 function fetchRow( $res ) {
897914 @/**/$row = mysql_fetch_array( $res );

Follow-up revisions

RevisionCommit summaryAuthorDate
r90455Extension updates for r90429: use query() instead of doQuery(), which has bee...tstarling12:02, 20 June 2011
r90458Followup r90429:...tstarling12:09, 20 June 2011