class Sequel::Mysql2::Dataset
Constants
- PreparedStatementMethods
- STREAMING_SUPPORTED
Public Instance Methods
Source
# File lib/sequel/adapters/mysql2.rb 248 def fetch_rows(sql) 249 execute(sql) do |r| 250 self.columns = r.fields.map!{|c| output_identifier(c.to_s)} 251 r.each(:cast_booleans=>convert_tinyint_to_bool?){|h| yield h} 252 end 253 self 254 end
Source
# File lib/sequel/adapters/mysql2.rb 258 def paged_each(opts=OPTS, &block) 259 if STREAMING_SUPPORTED && opts[:stream] != false 260 unless defined?(yield) 261 return enum_for(:paged_each, opts) 262 end 263 stream.each(&block) 264 else 265 super 266 end 267 end
Use streaming to implement paging if Mysql2 supports it and it hasn’t been disabled.
Calls superclass method
Sequel::Dataset#paged_each
Source
# File lib/sequel/adapters/mysql2.rb 272 def stream 273 clone(:stream=>true) 274 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).
Private Instance Methods
Source
# File lib/sequel/adapters/mysql2.rb 293 def bound_variable_modules 294 [PreparedStatementMethods] 295 end
Source
# File lib/sequel/adapters/mysql2.rb 281 def convert_tinyint_to_bool? 282 @db.convert_tinyint_to_bool 283 end
Whether to cast tinyint(1) columns to integer instead of boolean. By default, uses the database’s convert_tinyint_to_bool setting. Exists for compatibility with the mysql adapter.
Source
# File lib/sequel/adapters/mysql2.rb 285 def execute(sql, opts=OPTS) 286 opts = Hash[opts] 287 opts[:type] = :select 288 opts[:stream] = @opts[:stream] 289 super 290 end
Calls superclass method
Sequel::Dataset#execute
Source
# File lib/sequel/adapters/mysql2.rb 303 def literal_string_append(sql, v) 304 sql << "'" << db.synchronize(@opts[:server]){|c| c.escape(v)} << "'" 305 end
Handle correct quoting of strings using ::Mysql2::Client#escape.
Source
# File lib/sequel/adapters/mysql2.rb 297 def prepared_statement_modules 298 [PreparedStatementMethods] 299 end