Index: trunk/phase3/includes/Database.php |
— | — | @@ -655,10 +655,15 @@ |
656 | 656 | } |
657 | 657 | |
658 | 658 | /** |
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 |
661 | 666 | */ |
662 | | - function query( $sql, $fname = '', $tempIgnore = false ) { |
| 667 | + public function query( $sql, $fname = '', $tempIgnore = false ) { |
663 | 668 | global $wgProfiling; |
664 | 669 | |
665 | 670 | if ( $wgProfiling ) { |
— | — | @@ -735,9 +740,11 @@ |
736 | 741 | |
737 | 742 | /** |
738 | 743 | * 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 |
740 | 747 | */ |
741 | | - function doQuery( $sql ) { |
| 748 | + /*private*/ function doQuery( $sql ) { |
742 | 749 | if( $this->bufferResults() ) { |
743 | 750 | $ret = mysql_query( $sql, $this->mConn ); |
744 | 751 | } else { |
— | — | @@ -878,7 +885,13 @@ |
879 | 886 | } |
880 | 887 | |
881 | 888 | /** |
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 |
883 | 896 | */ |
884 | 897 | function fetchObject( $res ) { |
885 | 898 | @/**/$row = mysql_fetch_object( $res ); |
— | — | @@ -889,8 +902,12 @@ |
890 | 903 | } |
891 | 904 | |
892 | 905 | /** |
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 |
895 | 912 | */ |
896 | 913 | function fetchRow( $res ) { |
897 | 914 | @/**/$row = mysql_fetch_array( $res ); |