Sha256: d1760ab95bfeb3ddcc8caa38e271d0523f93cbb58e4a5eede875bfe70249f85c

Contents?: true

Size: 563 Bytes

Versions: 3

Compression:

Stored size: 563 Bytes

Contents

#This class controls the result for the MySQL2 driver.
class Baza::Driver::Mysql::ResultMysql2
  #Constructor. This should not be called manually.
  def initialize(result)
    @result = result
  end

  #Returns a single result.
  def fetch
    @enum = @result.to_enum if !@enum

    begin
      return @enum.next
    rescue StopIteration
      return false
    end
  end

  #Loops over every single result yielding it.
  def each
    @result.each do |res|
      next unless res #This sometimes happens when streaming results...
      yield(res)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
baza-0.0.17 include/drivers/mysql/mysql_result_mysql2.rb
baza-0.0.16 include/drivers/mysql/mysql_result_mysql2.rb
baza-0.0.15 include/drivers/mysql/mysql_result_mysql2.rb