[sr-dev] continuous rls related db_mysql errors

Juha Heinanen jh at tutpro.com
Thu Sep 26 17:11:31 CEST 2013


Juha Heinanen writes:

> that leads to the conclusion that transactions and table locking cannot
> be used together in mysql.

unless SET autocommit = 0 is done instead of START TRANSACTION:

  The correct way to use LOCK TABLES and UNLOCK TABLES with
  transactional tables, such as InnoDB tables, is to begin a transaction
  with SET autocommit = 0 (not START TRANSACTION) followed by LOCK
  TABLES, and to not call UNLOCK TABLES until you commit the transaction
  explicitly. For example, if you need to write to table t1 and read
  from table t2, you can do this: 

  SET autocommit=0;
  LOCK TABLES t1 WRITE, t2 READ, ...;
  ... do something with tables t1 and t2 here ...
  COMMIT;
  UNLOCK TABLES;

i don't know that that implies regarding db_mysql module.

-- juha



More information about the sr-dev mailing list