in reply to DBIx::Class and locking tables

I haven't used it personally but it seems like

$schema->dbh_do("LOCK TABLES blah"); ... ... $schema->dbh_do("UNLOCK TABLES");

should do what you want. See the docs for DBIx::Class::Storage::DBI

Replies are listed 'Best First'.
Re^2: DBIx::Class and locking tables
by Anonymous Monk on Aug 12, 2010 at 17:26 UTC

    Thank you, problem solved. That was really what I wanted. It's done a bit differently, but now it was easy.

    There is one thing. Generated SQL sometimes refers to table by it's name and sometimes by alias 'me'. I had to lock the table as itself and with alias, but then it worked.

    My code:

    my $res = $schema->storage->dbh_do(sub { my ($storage, $dbh) = @_; $dbh->do(" LOCK TABLES tbl AS tbl WRITE, tbl AS me WRITE "); }); # now use locked tables as usual

    Unlocking is done the same way.

    ico