Class: Fatalistic::MySQLLocker
Overview
Table locking for MySQL.
Instance Attribute Summary
Attributes inherited from Locker
Instance Method Summary collapse
Methods inherited from Locker
Constructor Details
This class inherits a constructor from Fatalistic::Locker
Instance Method Details
#lock(lock_statement = nil) ⇒ Object
55 56 57 58 59 60 |
# File 'lib/fatalistic.rb', line 55 def lock(lock_statement = nil) stmt = "LOCK TABLES #{quoted_table_name}" lock_statement ||= "WRITE" stmt.insert(-1, " #{lock_statement}") connection.execute(stmt) end |
#unlock ⇒ Object
62 63 64 |
# File 'lib/fatalistic.rb', line 62 def unlock connection.execute("UNLOCK TABLES") end |