Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
ca9293b3
Commit
ca9293b3
authored
Apr 27, 2006
by
Steven Wittens
Browse files
#54981
: calls to db_lock_table in bootstrap.inc do not use db_prefix
parent
b1762700
Changes
4
Hide whitespace changes
Inline
Side-by-side
includes/database.inc
View file @
ca9293b3
...
...
@@ -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".
*/
...
...
includes/database.mysql.inc
View file @
ca9293b3
...
...
@@ -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'
);
}
/**
...
...
includes/database.mysqli.inc
View file @
ca9293b3
...
...
@@ -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'
);
}
/**
...
...
includes/database.pgsql.inc
View file @
ca9293b3
...
...
@@ -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'
);
}
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment