class ThinkingSphinx::Connection::MRI

Attributes

options[R]

Public Class Methods

new(options) click to toggle source
# File lib/thinking_sphinx/connection.rb, line 100
def initialize(options)
  @options = options
end

Public Instance Methods

base_error() click to toggle source
# File lib/thinking_sphinx/connection.rb, line 104
def base_error
  Mysql2::Error
end

Private Instance Methods

client() click to toggle source
# File lib/thinking_sphinx/connection.rb, line 112
def client
  @client ||= Mysql2::Client.new({
    :flags => Mysql2::Client::MULTI_STATEMENTS
  }.merge(options))
rescue base_error => error
  raise ThinkingSphinx::SphinxError.new_from_mysql error
end
results_for(*statements) click to toggle source
# File lib/thinking_sphinx/connection.rb, line 120
def results_for(*statements)
  results  = [client.query(statements.join('; '))]
  results << client.store_result while client.next_result
  results
end