Included modules
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 247 def fetch_rows(sql) 248 execute(sql) do |r| 249 self.columns = r.fields.map!{|c| output_identifier(c.to_s)} 250 r.each(:cast_booleans=>convert_tinyint_to_bool?){|h| yield h} 251 end 252 self 253 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 257 def paged_each(opts=OPTS, &block) 258 if STREAMING_SUPPORTED && opts[:stream] != false 259 unless defined?(yield) 260 return enum_for(:paged_each, opts) 261 end 262 stream.each(&block) 263 else 264 super 265 end 266 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 271 def stream 272 clone(:stream=>true) 273 end