MDL-20334 get_in_or_equal() does not accept empty array

This commit is contained in:
mudrd8mz 2009-09-22 21:03:38 +00:00
parent 96158ee548
commit 1336c8ebca

View File

@ -522,6 +522,9 @@ abstract class moodle_database {
* @return array - $sql and $params
*/
public function get_in_or_equal($items, $type=SQL_PARAMS_QM, $start='param0000', $equal=true) {
if (empty($items) and is_array($items)) {
throw new coding_exception('moodle_database::get_in_or_equal() does not accept empty arrays');
}
if ($type == SQL_PARAMS_QM) {
if (!is_array($items) or count($items) == 1) {
$sql = $equal ? '= ?' : '<> ?';