Sha256: 0163eaa3f77d0e7fd5ad49743c6e6a14504c737d8cf1939e5a9db93fec9b7660
Contents?: true
Size: 1.08 KB
Versions: 17
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true class ThinkingSphinx::ActiveRecord::DatabaseAdapters::PostgreSQLAdapter < ThinkingSphinx::ActiveRecord::DatabaseAdapters::AbstractAdapter def boolean_value(value) value ? 'TRUE' : 'FALSE' end def cast_to_bigint(clause) "#{clause}::bigint" end def cast_to_string(clause) "#{clause}::varchar" end def cast_to_timestamp(clause) if ThinkingSphinx::Configuration.instance.settings['64bit_timestamps'] "extract(epoch from #{clause})::bigint" else "extract(epoch from #{clause})::int" end end def concatenate(clause, separator = ' ') clause.split(', ').collect { |part| convert_nulls(part, "''") }.join(" || '#{separator}' || ") end def convert_nulls(clause, default = '') "COALESCE(#{clause}, #{default})" end def convert_blank(clause, default = '') "COALESCE(NULLIF(#{clause}, ''), #{default})" end def group_concatenate(clause, separator = ' ') "array_to_string(array_agg(DISTINCT #{clause}), '#{separator}')" end def time_zone_query_pre ['SET TIME ZONE UTC'] end end
Version data entries
17 entries across 17 versions & 1 rubygems