module Surus::SynchronousCommit::Connection
Public Instance Methods
synchronous_commit(value=:not_passed_param)
click to toggle source
When called without any value returns the current synchronous_commit
value.
When called with a value it is delegated to synchronous_commit=
# File lib/surus/synchronous_commit/connection.rb, line 8 def synchronous_commit(value=:not_passed_param) if value == :not_passed_param select_value("SHOW synchronous_commit") == "on" else self.synchronous_commit = value end end
synchronous_commit=(value)
click to toggle source
Changes current synchronous_commit
state. If a transaction is currently in progress the change will be reverted at the end of the transaction.
Requires true or false to be passed exactly – not merely truthy or falsy
# File lib/surus/synchronous_commit/connection.rb, line 20 def synchronous_commit=(value) raise ArgumentError, "argument must be true or false" unless value == true || value == false execute "SET #{'LOCAL' if open_transactions > 0} synchronous_commit TO #{value ? 'ON' : 'OFF'}" end