mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
lib/dml: new compatibility method sql_cast_2signed for when MySQL thinks that 1 * -1 = 18446744073709551615
This commit is contained in:
parent
3efb762e6b
commit
adff97c505
@ -1518,6 +1518,19 @@ abstract class moodle_database {
|
|||||||
return ' ' . $fieldname . ' ';
|
return ' ' . $fieldname . ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the SQL to be used in order to an UNSIGNED INTEGER column to SIGNED.
|
||||||
|
*
|
||||||
|
* (Only MySQL needs this. MySQL things that 1 * -1 = 18446744073709551615
|
||||||
|
* if the 1 comes from an unsigned column).
|
||||||
|
*
|
||||||
|
* @param string fieldname the name of the field to be cast
|
||||||
|
* @return string the piece of SQL code to be used in your statement.
|
||||||
|
*/
|
||||||
|
public function sql_cast_2signed($fieldname) {
|
||||||
|
return ' ' . $fieldname . ' ';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the SQL text to be used to compare one TEXT (clob) column with
|
* Returns the SQL text to be used to compare one TEXT (clob) column with
|
||||||
* one varchar column, because some RDBMS doesn't support such direct
|
* one varchar column, because some RDBMS doesn't support such direct
|
||||||
|
@ -291,6 +291,10 @@ class mysqli_adodb_moodle_database extends adodb_moodle_database {
|
|||||||
return $positivematch ? 'REGEXP' : 'NOT REGEXP';
|
return $positivematch ? 'REGEXP' : 'NOT REGEXP';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sql_cast_2signed($fieldname) {
|
||||||
|
return ' CAST(' . $fieldname . ' AS SIGNED) ';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Import a record into a table, id field is required.
|
* Import a record into a table, id field is required.
|
||||||
* Basic safety checks only. Lobs are supported.
|
* Basic safety checks only. Lobs are supported.
|
||||||
|
@ -905,6 +905,10 @@ class mysqli_native_moodle_database extends moodle_database {
|
|||||||
return $positivematch ? 'REGEXP' : 'NOT REGEXP';
|
return $positivematch ? 'REGEXP' : 'NOT REGEXP';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sql_cast_2signed($fieldname) {
|
||||||
|
return ' CAST(' . $fieldname . ' AS SIGNED) ';
|
||||||
|
}
|
||||||
|
|
||||||
/// session locking
|
/// session locking
|
||||||
public function session_lock_supported() {
|
public function session_lock_supported() {
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user