Sha256: a969edbe0d36dbff66ef30c29ec8a491107a0e9528f2496eacb10f6e717875ee

Contents?: true

Size: 649 Bytes

Versions: 5

Compression:

Stored size: 649 Bytes

Contents

class ThinkingSphinx::ActiveRecord::DatabaseAdapters::PostgreSQLAdapter <
  ThinkingSphinx::ActiveRecord::DatabaseAdapters::AbstractAdapter

  def boolean_value(value)
    value ? 'TRUE' : 'FALSE'
  end

  def cast_to_timestamp(clause)
    "extract(epoch from #{clause})::int"
  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 group_concatenate(clause, separator = ' ')
    "array_to_string(array_agg(#{clause}), '#{separator}')"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
thinking-sphinx-3.0.2 lib/thinking_sphinx/active_record/database_adapters/postgresql_adapter.rb
thinking-sphinx-3.0.1 lib/thinking_sphinx/active_record/database_adapters/postgresql_adapter.rb
thinking-sphinx-3.0.0 lib/thinking_sphinx/active_record/database_adapters/postgresql_adapter.rb
thinking-sphinx-3.0.0.rc lib/thinking_sphinx/active_record/database_adapters/postgresql_adapter.rb
thinking-sphinx-3.0.0.pre lib/thinking_sphinx/active_record/database_adapters/postgresql_adapter.rb