Class: ThinkingSphinx::ActiveRecord::SQLBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/thinking_sphinx/active_record/sql_builder.rb

Defined Under Namespace

Classes: ClauseBuilder, Query, Statement

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (SQLBuilder) initialize(source)

Returns a new instance of SQLBuilder



6
7
8
# File 'lib/thinking_sphinx/active_record/sql_builder.rb', line 6

def initialize(source)
  @source = source
end

Instance Attribute Details

- (Object) source (readonly)

Returns the value of attribute source



4
5
6
# File 'lib/thinking_sphinx/active_record/sql_builder.rb', line 4

def source
  @source
end

Instance Method Details

- (Object) sql_query



10
11
12
# File 'lib/thinking_sphinx/active_record/sql_builder.rb', line 10

def sql_query
  statement.to_relation.to_sql.gsub(/\n/, "\\\n")
end

- (Object) sql_query_info



19
20
21
# File 'lib/thinking_sphinx/active_record/sql_builder.rb', line 19

def sql_query_info
  statement.to_query_info_relation.to_sql
end

- (Object) sql_query_pre



23
24
25
# File 'lib/thinking_sphinx/active_record/sql_builder.rb', line 23

def sql_query_pre
  query.to_query
end

- (Object) sql_query_range



14
15
16
17
# File 'lib/thinking_sphinx/active_record/sql_builder.rb', line 14

def sql_query_range
  return nil if source.disable_range?
  statement.to_query_range_relation.to_sql
end