MDL-17880 fixed removing of leading 0 from strings when emulating bounds in DML

This commit is contained in:
skodak
2009-01-13 13:12:59 +00:00
parent 1c82b3f2d9
commit c1a6529be1
2 changed files with 7 additions and 2 deletions
+3 -1
View File
@@ -525,7 +525,9 @@ abstract class adodb_moodle_database extends moodle_database {
$return .= (int)$param;
} else if (is_null($param)) {
$return .= 'NULL';
} else if (is_numeric($param)) {
} else if (is_number($param)) { // we can not use is_numeric() because it eats leading zeros from strings like 0045646
$return .= $param;
} else if (is_float($param)) {
$return .= $param;
} else {
$param = $this->adodb->qstr($param);
+4 -1
View File
@@ -420,7 +420,9 @@ class mysqli_native_moodle_database extends moodle_database {
$return .= (int)$param;
} else if (is_null($param)) {
$return .= 'NULL';
} else if (is_numeric($param)) {
} else if (is_number($param)) { // we can not use is_numeric() because it eats leading zeros from strings like 0045646
$return .= $param;
} else if (is_float($param)) {
$return .= $param;
} else {
$param = $this->mysqli->real_escape_string($param);
@@ -806,6 +808,7 @@ class mysqli_native_moodle_database extends moodle_database {
array_unshift($params, $newvalue);
}
$sql = "UPDATE {$this->prefix}$table SET $newfield $select";
var_dump($params);
$rawsql = $this->emulate_bound_params($sql, $params);
$this->query_start($sql, $params, SQL_QUERY_UPDATE);