mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 19:06:41 +02:00
Merge branch 'MDL-66110-master-fix' of git://github.com/junpataleta/moodle
This commit is contained in:
commit
191d4bc191
1 changed files with 14 additions and 8 deletions
|
@ -675,7 +675,8 @@ class mysqli_native_moodle_database extends moodle_database {
|
||||||
*/
|
*/
|
||||||
public function get_indexes($table) {
|
public function get_indexes($table) {
|
||||||
$indexes = array();
|
$indexes = array();
|
||||||
$sql = "SHOW INDEXES FROM {$this->prefix}$table";
|
$fixedtable = $this->fix_table_name($table);
|
||||||
|
$sql = "SHOW INDEXES FROM $fixedtable";
|
||||||
$this->query_start($sql, null, SQL_QUERY_AUX);
|
$this->query_start($sql, null, SQL_QUERY_AUX);
|
||||||
$result = $this->mysqli->query($sql);
|
$result = $this->mysqli->query($sql);
|
||||||
try {
|
try {
|
||||||
|
@ -746,7 +747,8 @@ class mysqli_native_moodle_database extends moodle_database {
|
||||||
} else {
|
} else {
|
||||||
// temporary tables are not in information schema, let's try it the old way
|
// temporary tables are not in information schema, let's try it the old way
|
||||||
$result->close();
|
$result->close();
|
||||||
$sql = "SHOW COLUMNS FROM {$this->prefix}$table";
|
$fixedtable = $this->fix_table_name($table);
|
||||||
|
$sql = "SHOW COLUMNS FROM $fixedtable";
|
||||||
$this->query_start($sql, null, SQL_QUERY_AUX);
|
$this->query_start($sql, null, SQL_QUERY_AUX);
|
||||||
$result = $this->mysqli->query($sql);
|
$result = $this->mysqli->query($sql);
|
||||||
$this->query_end(true);
|
$this->query_end(true);
|
||||||
|
@ -1317,8 +1319,8 @@ class mysqli_native_moodle_database extends moodle_database {
|
||||||
$fields = implode(',', array_keys($params));
|
$fields = implode(',', array_keys($params));
|
||||||
$qms = array_fill(0, count($params), '?');
|
$qms = array_fill(0, count($params), '?');
|
||||||
$qms = implode(',', $qms);
|
$qms = implode(',', $qms);
|
||||||
|
$fixedtable = $this->fix_table_name($table);
|
||||||
$sql = "INSERT INTO {$this->prefix}$table ($fields) VALUES($qms)";
|
$sql = "INSERT INTO $fixedtable ($fields) VALUES($qms)";
|
||||||
|
|
||||||
list($sql, $params, $type) = $this->fix_sql_params($sql, $params);
|
list($sql, $params, $type) = $this->fix_sql_params($sql, $params);
|
||||||
$rawsql = $this->emulate_bound_params($sql, $params);
|
$rawsql = $this->emulate_bound_params($sql, $params);
|
||||||
|
@ -1483,7 +1485,8 @@ class mysqli_native_moodle_database extends moodle_database {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "INSERT INTO {$this->prefix}$table $fieldssql VALUES $valuessql";
|
$fixedtable = $this->fix_table_name($table);
|
||||||
|
$sql = "INSERT INTO $fixedtable $fieldssql VALUES $valuessql";
|
||||||
|
|
||||||
list($sql, $params, $type) = $this->fix_sql_params($sql, $params);
|
list($sql, $params, $type) = $this->fix_sql_params($sql, $params);
|
||||||
$rawsql = $this->emulate_bound_params($sql, $params);
|
$rawsql = $this->emulate_bound_params($sql, $params);
|
||||||
|
@ -1547,7 +1550,8 @@ class mysqli_native_moodle_database extends moodle_database {
|
||||||
$params[] = $id; // last ? in WHERE condition
|
$params[] = $id; // last ? in WHERE condition
|
||||||
|
|
||||||
$sets = implode(',', $sets);
|
$sets = implode(',', $sets);
|
||||||
$sql = "UPDATE {$this->prefix}$table SET $sets WHERE id=?";
|
$fixedtable = $this->fix_table_name($table);
|
||||||
|
$sql = "UPDATE $fixedtable SET $sets WHERE id=?";
|
||||||
|
|
||||||
list($sql, $params, $type) = $this->fix_sql_params($sql, $params);
|
list($sql, $params, $type) = $this->fix_sql_params($sql, $params);
|
||||||
$rawsql = $this->emulate_bound_params($sql, $params);
|
$rawsql = $this->emulate_bound_params($sql, $params);
|
||||||
|
@ -1621,7 +1625,8 @@ class mysqli_native_moodle_database extends moodle_database {
|
||||||
$newfield = "$newfield = ?";
|
$newfield = "$newfield = ?";
|
||||||
array_unshift($params, $normalised_value);
|
array_unshift($params, $normalised_value);
|
||||||
}
|
}
|
||||||
$sql = "UPDATE {$this->prefix}$table SET $newfield $select";
|
$fixedtable = $this->fix_table_name($table);
|
||||||
|
$sql = "UPDATE $fixedtable SET $newfield $select";
|
||||||
$rawsql = $this->emulate_bound_params($sql, $params);
|
$rawsql = $this->emulate_bound_params($sql, $params);
|
||||||
|
|
||||||
$this->query_start($sql, $params, SQL_QUERY_UPDATE);
|
$this->query_start($sql, $params, SQL_QUERY_UPDATE);
|
||||||
|
@ -1644,7 +1649,8 @@ class mysqli_native_moodle_database extends moodle_database {
|
||||||
if ($select) {
|
if ($select) {
|
||||||
$select = "WHERE $select";
|
$select = "WHERE $select";
|
||||||
}
|
}
|
||||||
$sql = "DELETE FROM {$this->prefix}$table $select";
|
$fixedtable = $this->fix_table_name($table);
|
||||||
|
$sql = "DELETE FROM $fixedtable $select";
|
||||||
|
|
||||||
list($sql, $params, $type) = $this->fix_sql_params($sql, $params);
|
list($sql, $params, $type) = $this->fix_sql_params($sql, $params);
|
||||||
$rawsql = $this->emulate_bound_params($sql, $params);
|
$rawsql = $this->emulate_bound_params($sql, $params);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue