class Sequel::Mysql2::Dataset

  1. lib/sequel/adapters/mysql2.rb
Superclass: Dataset

Methods

Public Instance

  1. fetch_rows
  2. paged_each
  3. stream

Constants

PreparedStatementMethods = prepared_statements_module( "sql = self; opts = Hash[opts]; opts[:arguments] = bind_arguments", Sequel::Dataset::UnnumberedArgumentMapper, %w"execute execute_dui execute_insert")  
STREAMING_SUPPORTED = ::Mysql2::VERSION >= '0.3.12'  

Public Instance methods

fetch_rows(sql)
[show source]
    # File lib/sequel/adapters/mysql2.rb
240 def fetch_rows(sql)
241   execute(sql) do |r|
242     self.columns = r.fields.map!{|c| output_identifier(c.to_s)}
243     r.each(:cast_booleans=>convert_tinyint_to_bool?){|h| yield h}
244   end
245   self
246 end
paged_each(opts=OPTS, &block)

Use streaming to implement paging if Mysql2 supports it and it hasn’t been disabled.

[show source]
    # File lib/sequel/adapters/mysql2.rb
250 def paged_each(opts=OPTS, &block)
251   if STREAMING_SUPPORTED && opts[:stream] != false
252     unless defined?(yield)
253       return enum_for(:paged_each, opts)
254     end
255     stream.each(&block)
256   else
257     super
258   end
259 end
stream()

Return a clone of the dataset that will stream rows when iterating over the result set, so it can handle large datasets that won’t fit in memory (Requires mysql 0.3.12+ to have an effect).

[show source]
    # File lib/sequel/adapters/mysql2.rb
264 def stream
265   clone(:stream=>true)
266 end