Sha256: 079a594240dfd7ba09fbd210e141b78ccec4a92633b1232b662b48c44e2873ff

Contents?: true

Size: 617 Bytes

Versions: 3

Compression:

Stored size: 617 Bytes

Contents

class ThinkingSphinx::Connection::MRI < ThinkingSphinx::Connection::Client
  def initialize(options)
    @options = options
  end

  def base_error
    Mysql2::Error
  end

  private

  attr_reader :options

  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

  def results_for(statements)
    results  = [client.query(statements)]
    results << client.store_result while client.next_result
    results
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
thinking-sphinx-3.4.2 lib/thinking_sphinx/connection/mri.rb
thinking-sphinx-3.4.1 lib/thinking_sphinx/connection/mri.rb
thinking-sphinx-3.4.0 lib/thinking_sphinx/connection/mri.rb