lib/superstore/adapters/abstract_adapter.rb in superstore-2.4.4 vs lib/superstore/adapters/abstract_adapter.rb in superstore-2.5.0
- old
+ new
@@ -1,12 +1,9 @@
module Superstore
module Adapters
class AbstractAdapter
- attr_reader :config
- def initialize(config)
- @config = config
- @batch_statements = nil
+ def initialize
end
# Read records from a instance of Superstore::Scope
def select(scope) # abstract
end
@@ -19,32 +16,9 @@
def update(table, id, attributes) # abstract
end
# Delete rows by an array of ids
def delete(table, ids) # abstract
- end
-
- def execute_batch(statements) # abstract
- end
-
- def batching?
- !@batch_statements.nil?
- end
-
- def batch
- @batch_statements = []
- yield
- execute_batch(@batch_statements) if @batch_statements.any?
- ensure
- @batch_statements = nil
- end
-
- def execute_batchable(statement)
- if @batch_statements
- @batch_statements << statement
- else
- execute statement
- end
end
end
end
end