* For SELECT queries, this returns either:
* - a) A driver-specific value/resource, only on success. This can be iterated
* over by calling fetchObject()/fetchRow() until there are no more rows.
- * Alternatively, the result can be passed to resultObject() to obtain a
- * ResultWrapper instance which can then be iterated over via "foreach".
+ * Alternatively, the result can be passed to resultObject() to obtain an
+ * IResultWrapper instance which can then be iterated over via "foreach".
* - b) False, on any query failure
*
* For non-SELECT queries, this returns either:
protected function isTransactableQuery( $sql ) {
return !in_array(
$this->getQueryVerb( $sql ),
- [ 'BEGIN', 'ROLLBACK', 'COMMIT', 'SET', 'SHOW', 'CREATE', 'ALTER', 'USE' ],
+ [ 'BEGIN', 'ROLLBACK', 'COMMIT', 'SET', 'SHOW', 'CREATE', 'ALTER', 'USE', 'SHOW' ],
true
);
}
* Actually run any "atomic section cancel" callbacks.
*
* @param int $trigger IDatabase::TRIGGER_* constant
- * @param AtomicSectionIdentifier[]|null $sectionId Section IDs to cancel,
+ * @param AtomicSectionIdentifier[]|null $sectionIds Section IDs to cancel,
* null on transaction rollback
*/
private function runOnAtomicSectionCancelCallbacks(
abstract protected function fetchAffectedRowCount();
/**
- * Take the result from a query, and wrap it in a ResultWrapper if
- * necessary. Boolean values are passed through as is, to indicate success
- * of write queries or failure.
+ * Take a query result and wrap it in an iterable result wrapper if necessary.
+ * Booleans are passed through as-is to indicate success/failure of write queries.
*
* Once upon a time, Database::query() returned a bare MySQL result
* resource, and it was necessary to call this function to convert it to
*/
protected function resultObject( $result ) {
if ( !$result ) {
- return false;
- } elseif ( $result instanceof ResultWrapper ) {
+ return false; // failed query
+ } elseif ( $result instanceof IResultWrapper ) {
return $result;
} elseif ( $result === true ) {
- // Successful write query
- return $result;
+ return $result; // succesful write query
} else {
return new ResultWrapper( $this, $result );
}