? cvs_get_vanilla.sh Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.64 diff -u -p -r1.64 bootstrap.inc --- includes/bootstrap.inc 25 Aug 2005 21:14:15 -0000 1.64 +++ includes/bootstrap.inc 29 Aug 2005 19:10:36 -0000 @@ -232,10 +232,10 @@ function variable_get($name, $default) { function variable_set($name, $value) { global $conf; - db_query('LOCK TABLE {variable} WRITE'); + db_lock_table('variable'); db_query("DELETE FROM {variable} WHERE name = '%s'", $name); db_query("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')", $name, serialize($value)); - db_query('UNLOCK TABLE'); + db_unlock_tables(); cache_clear_all('variables'); @@ -321,12 +321,12 @@ function cache_get($key) { function cache_set($cid, $data, $expire = CACHE_PERMANENT, $headers = NULL) { $data = db_encode_blob($data); - db_query('LOCK TABLE {cache} WRITE'); + db_lock_table('cache'); db_query("UPDATE {cache} SET data = '%s', created = %d, expire = %d, headers = '%s' WHERE cid = '%s'", $data, time(), $expire, $headers, $cid); if (!db_affected_rows()) { @db_query("INSERT INTO {cache} (cid, data, created, expire, headers) VALUES ('%s', '%s', %d, %d, '%s')", $cid, $data, time(), $expire, $headers); } - db_query('UNLOCK TABLE'); + db_unlock_tables(); } /** Index: includes/database.mysql.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.mysql.inc,v retrieving revision 1.35 diff -u -p -r1.35 database.mysql.inc --- includes/database.mysql.inc 25 Aug 2005 21:14:16 -0000 1.35 +++ includes/database.mysql.inc 29 Aug 2005 19:10:36 -0000 @@ -270,6 +270,21 @@ function db_escape_string($text) { } /** + * Lock a table. + */ +function db_lock_table($table) { + db_query('LOCK TABLES {%s} WRITE', $table); +} + +/** + * Unlock all locked tables. + */ +function db_unlock_tables() { + db_query('UNLOCK TABLES'); +} + + +/** * @} End of "ingroup database". */ Index: includes/database.pgsql.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.pgsql.inc,v retrieving revision 1.13 diff -u -p -r1.13 database.pgsql.inc --- includes/database.pgsql.inc 25 Aug 2005 21:14:16 -0000 1.13 +++ includes/database.pgsql.inc 29 Aug 2005 19:10:36 -0000 @@ -256,6 +256,22 @@ function db_escape_string($text) { } /** + * Lock a table. + * This function automatically starts a transaction. + */ +function db_lock_table($table) { + db_query('BEGIN; LOCK TABLE {%s} IN EXCLUSIVE MODE', $table); +} + +/** + * Unlock all locked tables. + * This function automatically commits a transation. + */ +function db_unlock_tables() { + db_query('COMMIT'); +} + +/** * @} End of "ingroup database". */