mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-15635 sqlite fixes - by Andrei Bautu
This commit is contained in:
parent
1c50df9f24
commit
a47c84c4bb
3 changed files with 227 additions and 67 deletions
|
@ -183,6 +183,7 @@ abstract class pdo_moodle_database extends moodle_database {
|
|||
$this->debug_query($sql);
|
||||
}
|
||||
$this->pdb->exec($sql);
|
||||
$this->reset_columns();
|
||||
return true;
|
||||
} catch (PDOException $ex) {
|
||||
$this->lastError = $ex->getMessage();
|
||||
|
@ -404,9 +405,14 @@ abstract class pdo_moodle_database extends moodle_database {
|
|||
$value = (int)$value; // prevent "false" problems
|
||||
}
|
||||
if (!empty($column->enums)) {
|
||||
if (!in_array((string)$value, $column->enums)) {
|
||||
debugging('Enum value '.s($value).' not allowed in field '.$field.' table '.$table.'.');
|
||||
return false;
|
||||
// workaround for problem with wrong enums
|
||||
if (is_null($value) and !$column->not_null) {
|
||||
// ok - nulls allowed
|
||||
} else {
|
||||
if (!in_array((string)$value, $column->enums)) {
|
||||
debugging('Enum value '.s($value).' not allowed in field '.$field.' table '.$table.'.');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
$cleaned[$field] = $value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue