Class: ScopedSearch::QueryBuilder::MysqlAdapter
- Inherits:
-
ScopedSearch::QueryBuilder
- Object
- ScopedSearch::QueryBuilder
- ScopedSearch::QueryBuilder::MysqlAdapter
- 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
Instance Attribute Summary
Attributes inherited from ScopedSearch::QueryBuilder
Instance Method Summary (collapse)
-
- (Object) sql_operator(operator, field)
Patches the default sql_operator method to add BINARY after the equals and not equals operator to force case-sensitive comparisons.
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
- (Object) sql_operator(operator, field)
Patches the default sql_operator method to add BINARY after the equals and not equals operator to force case-sensitive comparisons.
465 466 467 468 469 470 471 |
# File 'lib/scoped_search/query_builder.rb', line 465 def sql_operator(operator, field) if [:ne, :eq].include?(operator) && field.textual? "#{SQL_OPERATORS[operator]} BINARY" else super(operator, field) end end |