Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions lib/activerecord/tablefree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def destroy_all(*_args)
end

case ActiveRecord::VERSION::MAJOR
when 5, 6, 7
when 5, 6, 7, 8
def find_by_sql(*_args)
case tablefree_options[:database]
when :pretend_success
Expand All @@ -152,13 +152,8 @@ def find_by_sql(*_args)
end

def transaction
# case tablefree_options[:database]
# when :pretend_success
@_current_transaction_records ||= []
yield
# when :fail_fast
# raise NoDatabase.new("Can't #transaction on Tablefree class")
# end
end

def tablefree?
Expand All @@ -168,6 +163,21 @@ def tablefree?
def table_exists?
false
end

def data_source_exists?
false
end

def connection_pool
@connection_pool ||= Class.new do
def with_connection(*args)
yield ActiveRecord::Tablefree::Connection.new
end
def connection
self
end
end.new
end
end

module ClassMethods
Expand Down Expand Up @@ -231,7 +241,8 @@ def reload(*_args)
end
end

def add_to_transaction; end
def add_to_transaction(ensure_finalize = true)
end

private

Expand Down
8 changes: 5 additions & 3 deletions lib/activerecord/tablefree/connection.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
module ActiveRecord::Tablefree
class Connection < ActiveRecord::ConnectionAdapters::AbstractAdapter
def initialize
super(ActiveRecord::Base, nil, nil, { adapter: "tablefree" })
@connection = Object.new # The Raw Connection
@owner = nil
@instrumenter = ActiveSupport::Notifications.instrumenter
@logger = Object.new
@config = Object.new
@pool = nil
@schema_cache = ActiveRecord::Tablefree::SchemaCache.new
@quoted_column_names, @quoted_table_names = {}, {}
@visitor = Object.new
@lock = Object.new
@prepared_statements = false
end

Expand Down Expand Up @@ -71,5 +69,9 @@ def execute(*_args)
def cacheable_query(arel) # :nodoc:
ActiveRecord::Tablefree::StatementCache.partial_query visitor, arel.ast, collector
end

def internal_exec_query(sql, name = "SQL", binds = [], prepare: false, async: false, allow_retry: false) # :nodoc:
[]
end
end
end