}
}
+ /**
+ * Get the Database object in use
+ *
+ * @return DatabaseBase
+ */
+ public function getDatabase() {
+ return $this->mDb;
+ }
+
/**
* Do the query, using information from the object context. This function
* has been kept minimal to make it overridable if necessary, to allow for
$queryLimit,
$descending
);
+
$this->extractResultInfo( $this->mOffset, $queryLimit, $this->mResult );
$this->mQueryDone = true;
* @param $descending Boolean: query direction, false for ascending, true for descending
* @return ResultWrapper
*/
- function reallyDoQuery( $offset, $limit, $descending ) {
+ public function reallyDoQuery( $offset, $limit, $descending ) {
+ list( $tables, $fields, $conds, $fname, $options, $join_conds ) = $this->buildQueryInfo( $offset, $limit, $descending );
+ return $this->mDb->select( $tables, $fields, $conds, $fname, $options, $join_conds );
+ }
+
+ /**
+ * Build variables to use by the database wrapper.
+ *
+ * @param $offset String: index offset, inclusive
+ * @param $limit Integer: exact query limit
+ * @param $descending Boolean: query direction, false for ascending, true for descending
+ * @return array
+ */
+ protected function buildQueryInfo( $offset, $limit, $descending ) {
$fname = __METHOD__ . ' (' . $this->getSqlComment() . ')';
$info = $this->getQueryInfo();
$tables = $info['tables'];
$conds[] = $this->mIndexField . $operator . $this->mDb->addQuotes( $offset );
}
$options['LIMIT'] = intval( $limit );
- $res = $this->mDb->select( $tables, $fields, $conds, $fname, $options, $join_conds );
- return new ResultWrapper( $this->mDb, $res );
+ return array( $tables, $fields, $conds, $fname, $options, $join_conds );
}
/**
* @protected
*
* @param $row Object: the database result row
- * @return Array of <attr> => <value>
+ * @return Array of attribute => value
*/
function getRowAttrs( $row ) {
$class = $this->getRowClass( $row );
}
/**
- * Get a <select> element which has options for each of the allowed limits
+ * Get a "<select>" element which has options for each of the allowed limits
*
* @return String: HTML fragment
*/
}
/**
- * Get <input type="hidden"> elements for use in a method="get" form.
+ * Get \<input type="hidden"\> elements for use in a method="get" form.
* Resubmits all defined elements of the query string, except for a
* blacklist, passed in the $blacklist parameter.
*