Sha256: f6f953da3baaa7d7939784f3bd22d85648efe99ca1b0122735c53163047efbee
Contents?: true
Size: 825 Bytes
Versions: 1
Compression:
Stored size: 825 Bytes
Contents
module Seedy class DatabaseBuffer < AbstractBuffer @@limit = 2 class << self def flush begin_db_transaction @@buffer.length.times { record = @@buffer.shift execute(record.to_sql) } commit_db_transaction end def begin_db_transaction #:nodoc: execute "BEGIN" rescue Exception # Transactions aren't supported end def commit_db_transaction #:nodoc: execute "COMMIT" rescue Exception # Transactions aren't supported end def rollback_db_transaction #:nodoc: execute "ROLLBACK" rescue Exception # Transactions aren't supported end def execute(sql) puts sql Seedy.connection.query(sql) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
seedy-0.6.3 | lib/seedy/buffer/database_buffer.rb |