| 5 database.mysqli.inc | db_lock_table($table) |
| 5 database.pgsql.inc | db_lock_table($table) |
| 5 database.mysql.inc | db_lock_table($table) |
| 6 database.pgsql.inc | db_lock_table($table) |
| 6 database.mysqli.inc | db_lock_table($table) |
| 6 database.mysql.inc | db_lock_table($table) |
Lock a table.
Related topics
File
- includes/
database.mysql.inc, line 335 - Database interface code for MySQL database servers.
Code
function db_lock_table($table) {
db_query('LOCK TABLES {' . db_escape_table($table) . '} WRITE');
}
Login or register to post comments
Comments
Multiple table locks
db_lock_table() will only lock one table at a time. If you need a lock while accessing multiple tables, or if you use table aliases, use a LOCK TABLES statement through db_query() instead. Bear in mind that this will make your code MySQL dependent so should be considered a last resort for specific concurrency problems.
From the MySQL documentation: