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



4
5
6
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 4

def boolean_value(value)
  value ? 1 : 0
end

#cast_to_bigint(clause) ⇒ Object



8
9
10
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 8

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

#cast_to_string(clause) ⇒ Object



12
13
14
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 12

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

#cast_to_timestamp(clause) ⇒ Object



16
17
18
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 16

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

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



20
21
22
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 20

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

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



28
29
30
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 28

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

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



24
25
26
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 24

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

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



32
33
34
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 32

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

#time_zone_query_preObject



36
37
38
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 36

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

#utf8_query_preObject



40
41
42
# File 'lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb', line 40

def utf8_query_pre
  ['SET NAMES utf8']
end