--echo #
--echo # MDEV-20034 Add support for the pre-defined weak SYS_REFCURSOR
--echo #

--echo #
--echo # Dyadic operations
--echo #

DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
BEGIN NOT ATOMIC
  DECLARE c SYS_REFCURSOR;
  DECLARE i INT;
  SELECT c + i;
END;
$$
DELIMITER ;$$

DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
BEGIN NOT ATOMIC
  DECLARE c SYS_REFCURSOR;
  DECLARE i INT;
  SELECT c - i;
END;
$$
DELIMITER ;$$

DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
BEGIN NOT ATOMIC
  DECLARE c SYS_REFCURSOR;
  DECLARE i INT;
  SELECT c * i;
END;
$$
DELIMITER ;$$

DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
BEGIN NOT ATOMIC
  DECLARE c SYS_REFCURSOR;
  DECLARE i INT;
  SELECT c / i;
END;
$$
DELIMITER ;$$

DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
BEGIN NOT ATOMIC
  DECLARE c SYS_REFCURSOR;
  DECLARE i INT;
  SELECT c % i;
END;
$$
DELIMITER ;$$

DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
BEGIN NOT ATOMIC
  DECLARE c SYS_REFCURSOR;
  IF c = TRUE THEN
    SELECT 'TRUE';
  ELSE
    SELECT 'NOT TRUE';
  END IF;
END;
$$
DELIMITER ;$$


DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
BEGIN NOT ATOMIC
  DECLARE c SYS_REFCURSOR;
  SELECT STR_TO_DATE(c, '%W, %M %e, %Y');
END;
$$
DELIMITER ;$$

DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
BEGIN NOT ATOMIC
  DECLARE c SYS_REFCURSOR;
  SELECT DATE_FORMAT('2009-10-04 22:23:00', c); -- can_return_text
END;
$$
DELIMITER ;$$
