Class: ThinkingSphinx::ActiveRecord::DatabaseAdapters::MySQLAdapter

Inherits:
AbstractAdapter
  • Object
show all
Defined in:
lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb

Instance Method Summary collapse

Methods inherited from AbstractAdapter

#initialize, #quote, #quoted_table_name

Constructor Details

This class inherits a constructor from ThinkingSphinx::ActiveRecord::DatabaseAdapters::AbstractAdapter

Instance Method Details

#boolean_value(value) ⇒ Object



6
7
8
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 6

def boolean_value(value)
  value ? 1 : 0
end

#cast_to_bigint(clause) ⇒ Object



10
11
12
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 10

def cast_to_bigint(clause)
  "CAST(#{clause} AS UNSIGNED INTEGER)"
end

#cast_to_string(clause) ⇒ Object



14
15
16
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 14

def cast_to_string(clause)
  "CAST(#{clause} AS char)"
end

#cast_to_timestamp(clause) ⇒ Object



18
19
20
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 18

def cast_to_timestamp(clause)
  "UNIX_TIMESTAMP(#{clause})"
end

#concatenate(clause, separator = ' ') ⇒ Object



22
23
24
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 22

def concatenate(clause, separator = ' ')
  "CONCAT_WS('#{separator}', #{clause})"
end

#convert_blank(clause, default = '') ⇒ Object



30
31
32
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 30

def convert_blank(clause, default = '')
  "COALESCE(NULLIF(#{clause}, ''), #{default})"
end

#convert_nulls(clause, default = '') ⇒ Object



26
27
28
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 26

def convert_nulls(clause, default = '')
  "IFNULL(#{clause}, #{default})"
end

#group_concatenate(clause, separator = ' ') ⇒ Object



34
35
36
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 34

def group_concatenate(clause, separator = ' ')
  "GROUP_CONCAT(DISTINCT #{clause} SEPARATOR '#{separator}')"
end

#time_zone_query_preObject



38
39
40
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 38

def time_zone_query_pre
  ["SET TIME_ZONE = '+0:00'"]
end

#utf8_query_preObject



42
43
44
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 42

def utf8_query_pre
  ["SET NAMES #{settings['mysql_encoding']}"]
end