lib/thinking_sphinx/adapters/mysql_adapter.rb in pixeltrix-thinking-sphinx-1.1.5 vs lib/thinking_sphinx/adapters/mysql_adapter.rb in pixeltrix-thinking-sphinx-1.2.1
- old
+ new
@@ -11,11 +11,11 @@
def concatenate(clause, separator = ' ')
"CONCAT_WS('#{separator}', #{clause})"
end
def group_concatenate(clause, separator = ' ')
- "GROUP_CONCAT(#{clause} SEPARATOR '#{separator}')"
+ "GROUP_CONCAT(DISTINCT #{clause} SEPARATOR '#{separator}')"
end
def cast_to_string(clause)
"CAST(#{clause} AS CHAR)"
end
@@ -36,10 +36,11 @@
def boolean(value)
value ? 1 : 0
end
- def crc(clause)
+ def crc(clause, blank_to_null = false)
+ clause = "NULLIF(#{clause},'')" if blank_to_null
"CRC32(#{clause})"
end
def utf8_query_pre
"SET NAMES utf8"
\ No newline at end of file