Yield all rows matching this dataset.
# File lib/sequel/adapters/mysql2.rb, line 150 def fetch_rows(sql) execute(sql) do |r| @columns = if identifier_output_method r.fields.map!{|c| output_identifier(c.to_s)} else r.fields end r.each(:cast_booleans=>convert_tinyint_to_bool?){|h| yield h} end self end
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).
# File lib/sequel/adapters/mysql2.rb, line 165 def stream clone(:stream=>true) end
Whether to cast tinyint(1) columns to integer instead of boolean. By default, uses the opposite of the database's convert_tinyint_to_bool setting. Exists for compatibility with the mysql adapter.
# File lib/sequel/adapters/mysql2.rb, line 174 def convert_tinyint_to_bool? @db.convert_tinyint_to_bool end
Set the :type option to :select if it hasn't been set.
# File lib/sequel/adapters/mysql2.rb, line 179 def execute(sql, opts=OPTS, &block) super(sql, {:type=>:select, :stream=>@opts[:stream]}.merge(opts), &block) end
Handle correct quoting of strings using ::Mysql2::Client#escape.
# File lib/sequel/adapters/mysql2.rb, line 184 def literal_string_append(sql, v) sql << APOS << db.synchronize(@opts[:server]){|c| c.escape(v)} << APOS end