#54981: calls to db_lock_table in bootstrap.inc do not use db_prefix
parent
b176270018
commit
ca9293b3ee
|
@ -315,6 +315,15 @@ function db_rewrite_sql($query, $primary_table = 'n', $primary_field = 'nid', $
|
|||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restrict a dynamic tablename to safe characters.
|
||||
*
|
||||
* Only keeps alphanumeric and underscores.
|
||||
*/
|
||||
function db_escape_table($string) {
|
||||
return preg_replace('/[^A-Za-z0-9_]+/', '', $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "defgroup database".
|
||||
*/
|
||||
|
|
|
@ -353,7 +353,7 @@ function db_escape_string($text) {
|
|||
* Lock a table.
|
||||
*/
|
||||
function db_lock_table($table) {
|
||||
db_query('LOCK TABLES {%s} WRITE', $table);
|
||||
db_query('LOCK TABLES {'. db_escape_table($table) .'} WRITE');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -355,7 +355,7 @@ function db_escape_string($text) {
|
|||
* Lock a table.
|
||||
*/
|
||||
function db_lock_table($table) {
|
||||
db_query('LOCK TABLES {%s} WRITE', $table);
|
||||
db_query('LOCK TABLES {'. db_escape_table($table) .'} WRITE');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -331,7 +331,7 @@ function db_escape_string($text) {
|
|||
* This function automatically starts a transaction.
|
||||
*/
|
||||
function db_lock_table($table) {
|
||||
db_query('BEGIN; LOCK TABLE {%s} IN EXCLUSIVE MODE', $table);
|
||||
db_query('BEGIN; LOCK TABLE {'. db_escape_table($table) .'} IN EXCLUSIVE MODE');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue