Index: includes/database.pgsql.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/Attic/database.pgsql.inc,v
retrieving revision 1.68.2.2
diff -u -r1.68.2.2 database.pgsql.inc
--- includes/database.pgsql.inc	8 Jul 2008 09:50:03 -0000	1.68.2.2
+++ includes/database.pgsql.inc	22 Aug 2008 17:20:59 -0000
@@ -373,6 +373,17 @@
 }
 
 /**
+ * Lock tables.
+ *
+ * @param $table
+ *   Array of tables you want to lock.
+ */
+function db_lock_tables($tables) {
+  // TODO
+  // To be implemented by someone with better knowlegde of pgsql
+}
+
+/**
  * Unlock all locked tables.
  * This function automatically commits a transaction.
  */
Index: includes/database.mysql.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/Attic/database.mysql.inc,v
retrieving revision 1.89
diff -u -r1.89 database.mysql.inc
--- includes/database.mysql.inc	24 Jan 2008 10:46:54 -0000	1.89
+++ includes/database.mysql.inc	22 Aug 2008 17:20:59 -0000
@@ -322,20 +322,6 @@
 }
 
 /**
- * Lock a table.
- */
-function db_lock_table($table) {
-  db_query('LOCK TABLES {'. db_escape_table($table) .'} WRITE');
-}
-
-/**
- * Unlock all locked tables.
- */
-function db_unlock_tables() {
-  db_query('UNLOCK TABLES');
-}
-
-/**
  * Check if a table exists.
  */
 function db_table_exists($table) {
Index: includes/database.mysqli.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/Attic/database.mysqli.inc,v
retrieving revision 1.54
diff -u -r1.54 database.mysqli.inc
--- includes/database.mysqli.inc	23 Jan 2008 09:59:29 -0000	1.54
+++ includes/database.mysqli.inc	22 Aug 2008 17:20:59 -0000
@@ -324,20 +324,6 @@
 }
 
 /**
- * Lock a table.
- */
-function db_lock_table($table) {
-  db_query('LOCK TABLES {'. db_escape_table($table) .'} WRITE');
-}
-
-/**
- * Unlock all locked tables.
- */
-function db_unlock_tables() {
-  db_query('UNLOCK TABLES');
-}
-
-/**
  * Check if a table exists.
  */
 function db_table_exists($table) {
Index: includes/database.mysql-common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/Attic/database.mysql-common.inc,v
retrieving revision 1.17.2.1
diff -u -r1.17.2.1 database.mysql-common.inc
--- includes/database.mysql-common.inc	7 Feb 2008 10:17:26 -0000	1.17.2.1
+++ includes/database.mysql-common.inc	22 Aug 2008 17:20:59 -0000
@@ -531,3 +531,51 @@
 function db_last_insert_id($table, $field) {
   return db_result(db_query('SELECT LAST_INSERT_ID()'));
 }
+
+/**
+ * Lock a table.
+ *
+ * @param $table
+ *   The name of the table you want to lock.
+ */
+function db_lock_table($table) {
+  _db_lock_table_status($table);
+  return db_query('LOCK TABLES {'. db_escape_table($table) .'} WRITE');
+}
+
+/**
+ * Lock tables.
+ *
+ * @param $table
+ *   Array of tables you want to lock.
+ */
+function db_lock_tables($tables) {
+  _db_lock_table_status(implode(', ', $tables));
+  array_walk($tables, 'db_escape_table');
+  return db_query('LOCK TABLES {'. implode('} WRITE, {', $tables) .'} WRITE');
+}
+
+/**
+ * Unlock all locked tables.
+ */
+function db_unlock_tables() {
+  _db_lock_table_status();
+  return db_query('UNLOCK TABLES');
+}
+
+/**
+ * Lock a table.
+ *
+ * @param $table
+ *   The name of the table you want to lock.
+ */
+function _db_lock_table_status($tables = '') {
+  static $previous_tables = '';
+
+  if (!empty($tables) && !empty($previous_tables)) {
+    trigger_error('You implicitly unlocked some tables ('.$previous_tables.
+      ') by requesting new locks on these tables: '.$tables , E_USER_WARNING);
+  }
+
+  $previous_tables = $tables;
+}
