mirror of
https://github.com/moodle/moodle.git
synced 2025-06-02 22:25:04 +02:00
MDL-20334 get_in_or_equal() does not accept empty array
This commit is contained in:
parent
96158ee548
commit
1336c8ebca
@ -522,6 +522,9 @@ abstract class moodle_database {
|
|||||||
* @return array - $sql and $params
|
* @return array - $sql and $params
|
||||||
*/
|
*/
|
||||||
public function get_in_or_equal($items, $type=SQL_PARAMS_QM, $start='param0000', $equal=true) {
|
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 ($type == SQL_PARAMS_QM) {
|
||||||
if (!is_array($items) or count($items) == 1) {
|
if (!is_array($items) or count($items) == 1) {
|
||||||
$sql = $equal ? '= ?' : '<> ?';
|
$sql = $equal ? '= ?' : '<> ?';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user