MDL-81073 badges: better Oracle support for expiry filter.

Avoid the following error by casting the bound parameter:

ORA-00932: inconsistent datatypes: expected CHAR got NUMBER.
This commit is contained in:
Paul Holden 2024-03-18 16:34:59 +00:00
parent 2f9001cbe9
commit ba1f9cb26c
No known key found for this signature in database
GPG Key ID: A81A96D6045F6164

View File

@ -284,6 +284,8 @@ class badge extends base {
* @return filter[]
*/
protected function get_all_filters(): array {
global $DB;
$badgealias = $this->get_table_alias('badge');
// Name.
@ -330,9 +332,9 @@ class badge extends base {
'expiry',
new lang_string('expirydate', 'core_badges'),
$this->get_entity_name(),
"CASE
WHEN {$badgealias}.expiredate IS NULL AND {$badgealias}.expireperiod IS NULL THEN :{$parammaxint}
ELSE COALESCE({$badgealias}.expiredate, {$badgealias}.expireperiod + :{$paramtime})
"CASE WHEN {$badgealias}.expiredate IS NULL AND {$badgealias}.expireperiod IS NULL
THEN " . $DB->sql_cast_char2int(":{$parammaxint}") . "
ELSE COALESCE({$badgealias}.expiredate, {$badgealias}.expireperiod + :{$paramtime})
END",
[$parammaxint => 2147483647, $paramtime => time()]
))