class ThinkingSphinx::Connection::MRI

Attributes

address[R]
options[R]
port[R]

Public Class Methods

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

Public Instance Methods

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

Private Instance Methods

client() click to toggle source
# File lib/thinking_sphinx/connection.rb, line 109
def client
  @client ||= Mysql2::Client.new({
    :host  => address,
    :port  => port,
    :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 119
def results_for(*statements)
  results  = [client.query(statements.join('; '))]
  results << client.store_result while client.next_result
  results
end