Module: DbTextSearch::QueryBuilding Private
- Included in:
- CaseInsensitive::AbstractAdapter, FullText::AbstractAdapter
- Defined in:
- lib/db_text_search/query_building.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Common methods for building SQL that use @scope and @column instance variables.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.included(base) ⇒ Object
private
:nodoc:.
Instance Method Summary collapse
-
#sanitize_sql_like(string, escape_character = '\\') ⇒ String
private
SQL-quoted string suitable for use in a LIKE statement, with % and _ escaped.
Class Method Details
.included(base) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
:nodoc:
7 8 9 |
# File 'lib/db_text_search/query_building.rb', line 7 def self.included(base) # :nodoc: base.extend ClassMethods end |
Instance Method Details
#sanitize_sql_like(string, escape_character = '\\') ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns SQL-quoted string suitable for use in a LIKE statement, with % and _ escaped.
12 13 14 15 |
# File 'lib/db_text_search/query_building.rb', line 12 def sanitize_sql_like(string, escape_character = '\\') pattern = Regexp.union(escape_character, '%', '_') string.gsub(pattern) { |x| [escape_character, x].join } end |