class ThinkingSphinx::Connection::MRI

Attributes

options[R]

Public Class Methods

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

Public Instance Methods

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

Private Instance Methods

client() click to toggle source
# File lib/thinking_sphinx/connection/mri.rb, line 14
def client
  @client ||= Mysql2::Client.new({
    :flags           => Mysql2::Client::MULTI_STATEMENTS,
    :connect_timeout => 5
  }.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/mri.rb, line 23
def results_for(statements)
  results  = [client.query(statements)]
  results << client.store_result while client.next_result
  results
end