Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/connection_adapters/tokyotyrant_adapter.rb,
lib/active_record/connection_adapters/tokyocabinet_adapter.rb,
lib/active_record/connection_adapters/abstract_tokyocabinet_adapter.rb

Class Method Summary collapse

Class Method Details

.construct_finder_sql_with_activetokyocabinet(options) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/active_record/connection_adapters/abstract_tokyocabinet_adapter.rb', line 24

def construct_finder_sql_with_activetokyocabinet(options)
  sql = construct_finder_sql_without_activetokyocabinet(options)

  if self.include?(ActiveTokyoCabinet::TDB) and (proc = options[:activetokyocabinet_proc])
    sql = [sql, proc]
  end

  return sql
end

.find_by_sql_with_activetokyocabinet(args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/active_record/connection_adapters/abstract_tokyocabinet_adapter.rb', line 9

def find_by_sql_with_activetokyocabinet(args)
  retval = nil

  if self.include?(ActiveTokyoCabinet::TDB) and args.kind_of?(Array)
    sql, proc = args
    connection.select(sanitize_sql(sql), "#{name} Load", &proc)
    retval = []
  else
    retval = find_by_sql_without_activetokyocabinet(args)
  end

  return retval
end

.tokyocabinet_connection(config) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/active_record/connection_adapters/tokyocabinet_adapter.rb', line 6

def self.tokyocabinet_connection(config)
  unless config[:database].kind_of?(String)
    raise ArgumentError, "Incorrect argument: database"
  end

  if Object.const_defined?(:RAILS_ROOT)
    config[:database] = File.expand_path(config[:database], RAILS_ROOT)
  end

  ConnectionAdapters::TokyoCabinetAdapter.new(nil, logger, config)
end

.tokyotyrant_connection(config) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/active_record/connection_adapters/tokyotyrant_adapter.rb', line 6

def self.tokyotyrant_connection(config)
  unless config[:database].kind_of?(Hash)
    raise ArgumentError, "Incorrect argument: database"
  end

  ConnectionAdapters::TokyoTyrantAdapter.new({}, logger, config)
end