Hi,

Lots of us have providers which don't allow to lock tables.
The consequence is that we get messages like :

user warning: Access denied for user: 'wpeterson@%' to database 'droopy' query: LOCK TABLES sequences WRITE in c:\****\****\****\****\****\includes\database.mysql.inc on line 120.
user warning: Access denied for user: 'wpeterson@%' to database 'droopy' query: LOCK TABLES cache WRITE in c:\****\****\****\****\****\includes\database.mysql.inc on line 120.

One of the options we have is to change of providers. But it's not always possible.

In the case it's not possible, it would be nice to be able to parameter in a config file, if we can use the lock fonctionnality or not.

If yes ==> code working like now
If not ==> some conditionnal change in the code (some instructions like locking and unlocking being not executed).

The code in database.mysql.inc would look something like :

function db_next_id($name) {
$name = db_prefix_tables($name);
if possible_to_lock()
db_query('LOCK TABLES {sequences} WRITE');
else
{
/* do not lock tables */
...
}
$id = db_result(db_query("SELECT id FROM {sequences} WHERE name = '%s'", $name)) + 1;
db_query("REPLACE INTO {sequences} VALUES ('%s', %d)", $name, $id);
if possible_to_lock()
db_query('UNLOCK TABLES');
else
{
/* do not lock tables */
....
}
return $id;
}

Comments

beginner’s picture

Version: 4.7.2 » x.y.z

feature requests -> cvs.

killes@www.drop.org’s picture

Version: x.y.z » 4.7.2
Status: Active » Closed (duplicate)

Somewhere is an issue with a patch.

http://drupal.org/node/77312