Parent

Class/Module Index [+]

Quicksearch

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

connections[RW]

A hash holding the proxy connections

    1. {:left => <left connection>, :right => <right connection>}

session[RW]

The current Session object

Public Class Methods

new(session) click to toggle source

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

delete_record(database, table, values) click to toggle source

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
finalize(success = true) click to toggle source

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
insert_record(database, table, values) click to toggle source

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
new_transaction?() click to toggle source

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
update_record(database, table, values, old_key = nil) click to toggle source

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.