Skip to content

Commit

Permalink
MDL-49231 mod_glossary: Reverting back to not using recordsets
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Massart committed Jan 5, 2016
1 parent 2becd93 commit 5eabb5e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
8 changes: 0 additions & 8 deletions mod/glossary/classes/external.php
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,6 @@ public static function get_entries_by_letter($id, $letter, $from, $limit, $optio
self::fill_entry_details($record, $context);
$entries[] = $record;
}
$records->close();

return array(
'count' => $count,
Expand Down Expand Up @@ -589,7 +588,6 @@ public static function get_entries_by_date($id, $order, $sort, $from, $limit, $o
self::fill_entry_details($record, $context);
$entries[] = $record;
}
$records->close();

return array(
'count' => $count,
Expand Down Expand Up @@ -767,7 +765,6 @@ public static function get_entries_by_category($id, $categoryid, $from, $limit,
}
$entries[] = $record;
}
$records->close();

return array(
'count' => $count,
Expand Down Expand Up @@ -962,7 +959,6 @@ public static function get_entries_by_author($id, $letter, $field, $sort, $from,
self::fill_entry_details($record, $context);
$entries[] = $record;
}
$records->close();

return array(
'count' => $count,
Expand Down Expand Up @@ -1066,7 +1062,6 @@ public static function get_entries_by_author_id($id, $authorid, $order, $sort, $
self::fill_entry_details($record, $context);
$entries[] = $record;
}
$records->close();

return array(
'count' => $count,
Expand Down Expand Up @@ -1168,7 +1163,6 @@ public static function get_entries_by_search($id, $query, $fullsearch, $order, $
self::fill_entry_details($record, $context);
$entries[] = $record;
}
$records->close();

return array(
'count' => $count,
Expand Down Expand Up @@ -1249,7 +1243,6 @@ public static function get_entries_by_term($id, $term, $from, $limit, $options)
self::fill_entry_details($record, $context);
$entries[] = $record;
}
$records->close();

return array(
'count' => $count,
Expand Down Expand Up @@ -1336,7 +1329,6 @@ public static function get_entries_to_approve($id, $letter, $order, $sort, $from
self::fill_entry_details($record, $context);
$entries[] = $record;
}
$records->close();

return array(
'count' => $count,
Expand Down
20 changes: 13 additions & 7 deletions mod/glossary/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3386,7 +3386,7 @@ function glossary_get_entries_by_letter($glossary, $context, $letter, $from, $li

// Fetching the entries.
$count = $qb->count_records();
$entries = $qb->get_recordset();
$entries = $qb->get_records();

return array($entries, $count);
}
Expand Down Expand Up @@ -3429,7 +3429,7 @@ function glossary_get_entries_by_date($glossary, $context, $order, $sort, $from,

// Fetching the entries.
$count = $qb->count_records();
$entries = $qb->get_recordset();
$entries = $qb->get_records();

return array($entries, $count);
}
Expand Down Expand Up @@ -3459,6 +3459,12 @@ function glossary_get_entries_by_category($glossary, $context, $categoryid, $fro

$qb->join_category($categoryid);
$qb->join_user();

// The first field must be the relationship ID when viewing all categories.
if ($categoryid === GLOSSARY_SHOW_ALL_CATEGORIES) {
$qb->add_field('id', 'entries_categories', 'cid');
}

$qb->add_field('*', 'entries');
$qb->add_field('categoryid', 'entries_categories');
$qb->add_user_fields();
Expand All @@ -3478,7 +3484,7 @@ function glossary_get_entries_by_category($glossary, $context, $categoryid, $fro

// Fetching the entries.
$count = $qb->count_records();
$entries = $qb->get_recordset();
$entries = $qb->get_records();

return array($entries, $count);
}
Expand Down Expand Up @@ -3526,7 +3532,7 @@ function glossary_get_entries_by_author($glossary, $context, $letter, $field, $s

// Fetching the entries.
$count = $qb->count_records();
$entries = $qb->get_recordset();
$entries = $qb->get_records();

return array($entries, $count);
}
Expand Down Expand Up @@ -3574,7 +3580,7 @@ function glossary_get_entries_by_author_id($glossary, $context, $authorid, $orde

// Fetching the entries.
$count = $qb->count_records();
$entries = $qb->get_recordset();
$entries = $qb->get_records();

return array($entries, $count);
}
Expand Down Expand Up @@ -3817,7 +3823,7 @@ function glossary_get_entries_by_term($glossary, $context, $term, $from, $limit,

// Fetching the entries.
$count = $qb->count_records();
$entries = $qb->get_recordset();
$entries = $qb->get_records();

return array($entries, $count);
}
Expand Down Expand Up @@ -3861,7 +3867,7 @@ function glossary_get_entries_to_approve($glossary, $context, $letter, $order, $

// Fetching the entries.
$count = $qb->count_records();
$entries = $qb->get_recordset();
$entries = $qb->get_records();

return array($entries, $count);
}
Expand Down

0 comments on commit 5eabb5e

Please sign in to comment.