Class: ThinkingSphinx::AbstractAdapter
- Inherits:
-
Object
- Object
- ThinkingSphinx::AbstractAdapter
show all
- Defined in:
- lib/thinking_sphinx/xml/adapters/abstract_adapter.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.detect(model) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/thinking_sphinx/xml/adapters/abstract_adapter.rb', line 3
def self.detect(model)
case model.connection.class.name
when "ActiveRecord::ConnectionAdapters::MysqlAdapter",
"ActiveRecord::ConnectionAdapters::MysqlplusAdapter"
ThinkingSphinx::MysqlAdapter.new model
when "ActiveRecord::ConnectionAdapters::PostgreSQLAdapter"
ThinkingSphinx::PostgreSQLAdapter.new model
when "ActiveRecord::ConnectionAdapters::SQLite3Adapter"
ThinkingSphinx::SQLite3Adapter.new model
when "ActiveRecord::ConnectionAdapters::OracleAdapter",
"ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter"
ThinkingSphinx::OracleAdapter.new model
when "ActiveRecord::ConnectionAdapters::JdbcAdapter"
if model.connection.config[:adapter] == "jdbcmysql"
ThinkingSphinx::MysqlAdapter.new model
elsif model.connection.config[:adapter] == "jdbcpostgresql"
ThinkingSphinx::PostgreSQLAdapter.new model
else
raise "Invalid Database Adapter: Sphinx only supports MySQL and PostgreSQL"
end
else
raise "Invalid Database Adapter: Sphinx only supports MySQL and PostgreSQL, not #{model.connection.class.name}"
end
end
|
Instance Method Details
#select_each(query) ⇒ Object
28
29
30
31
32
|
# File 'lib/thinking_sphinx/xml/adapters/abstract_adapter.rb', line 28
def select_each(query)
connection.select_all(query).each do |values|
yield values
end
end
|