class RR::Committers::DefaultCommitter
This committer does not do anything. This means that the default DBMS behaviour is used (for most DBMS: every DML statement (insert, update, delete) runs in it's own transaction.
Attributes
A hash holding the proxy connections
-
{:left => <left connection>, :right => <right connection>}
-
The current Session object
Public Class Methods
A new committer is created for each table sync.
* session: a Session object representing the current database session
# File lib/rubyrep/committers/committers.rb, line 67 def initialize(session) self.session = session self.connections = {:left => session.left, :right => session.right} end
Public Instance Methods
Deletes the specified record in the specified database
(either
:left or :right). table
is the name of the target table.
values
is a hash of column_name => value pairs. (Only the
primary key values will be used and must be included in the hash.)
# File lib/rubyrep/committers/committers.rb, line 98 def delete_record(database, table, values) connections[database].delete_record(table, values) end
Is called after the last insert / update / delete query.
success
should be true if there were no problems, false
otherwise.
# File lib/rubyrep/committers/committers.rb, line 104 def finalize(success = true) end
Inserts the specified record in the specified database
(either
:left or :right). table
is the name of the target table.
values
is a hash of column_name => value pairs.
# File lib/rubyrep/committers/committers.rb, line 81 def insert_record(database, table, values) connections[database].insert_record(table, values) end
Returns true
if a new transaction was started since the last
insert / update / delete.
# File lib/rubyrep/committers/committers.rb, line 74 def new_transaction? false end
Updates the specified record in the specified database
(either
:left or :right). table
is the name of the target table.
values
is a hash of column_name => value pairs. #
old_key
is a column_name => value hash with the original
primary key. If old_key
is nil
, then the primary
key must be contained in values
.
# File lib/rubyrep/committers/committers.rb, line 90 def update_record(database, table, values, old_key = nil) connections[database].update_record(table, values, old_key) end