Class: ScopedSearch::QueryBuilder::Mysql2Adapter

Inherits:
ScopedSearch::QueryBuilder show all
Defined in:
lib/scoped_search/query_builder.rb

Overview

The MysqlAdapter makes sure that case sensitive comparisons are used when using the (not) equals operator, regardless of the field's collation setting.

Constant Summary

Constant Summary

Constants inherited from ScopedSearch::QueryBuilder

MysqlAdapter, SQL_OPERATORS

Instance Attribute Summary

Attributes inherited from ScopedSearch::QueryBuilder

#ast, #definition

Instance Method Summary collapse

Methods inherited from ScopedSearch::QueryBuilder

#build_find_params, build_query, class_for, #datetime_test, #has_many_through_join, #initialize, #order_by, #set_test, #sql_test, #to_not_sql, #translate_value

Constructor Details

This class inherits a constructor from ScopedSearch::QueryBuilder

Instance Method Details

#sql_operator(operator, field) ⇒ Object

BINARY after the equals and not equals operator to force case-sensitive comparisons.



486
487
488
489
490
491
492
# File 'lib/scoped_search/query_builder.rb', line 486

def sql_operator(operator, field)
  if [:ne, :eq].include?(operator) && field.textual?
    "#{SQL_OPERATORS[operator]} BINARY"
  else
    super(operator, field)
  end
end