class Sequel::IBMDB::Dataset

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

Included modules

  1. Sequel::DB2::DatasetMethods

Constants

PreparedStatementMethods = prepared_statements_module(:prepare_bind, Sequel::Dataset::UnnumberedArgumentMapper)  

Public Instance methods

convert_smallint_to_bool()

Whether to convert smallint to boolean arguments for this dataset. Defaults to the Database setting.

[show source]
    # File lib/sequel/adapters/ibmdb.rb
374 def convert_smallint_to_bool
375   opts.has_key?(:convert_smallint_to_bool) ? opts[:convert_smallint_to_bool] : db.convert_smallint_to_bool
376 end
fetch_rows(sql)
[show source]
    # File lib/sequel/adapters/ibmdb.rb
383 def fetch_rows(sql)
384   execute(sql) do |stmt|
385     columns = []
386     convert = convert_smallint_to_bool
387     cps = db.conversion_procs
388     stmt.num_fields.times do |i|
389       k = stmt.field_name i
390       key = output_identifier(k)
391       type = stmt.field_type(i).downcase.to_sym
392       # decide if it is a smallint from precision
393       type = :boolean  if type == :int && convert && stmt.field_precision(i) < 8
394       type = :blob if type == :clob && db.use_clob_as_blob
395       columns << [key, cps[type]]
396     end
397     cols = columns.map{|c| c[0]}
398     self.columns = cols
399 
400     while res = stmt.fetch_array
401       row = {}
402       res.zip(columns).each do |v, (k, pr)|
403         row[k] = ((pr ? pr.call(v) : v) if v)
404       end
405       yield row
406     end
407   end
408   self
409 end
with_convert_smallint_to_bool(v)

Return a cloned dataset with the convert_smallint_to_bool option set.

[show source]
    # File lib/sequel/adapters/ibmdb.rb
379 def with_convert_smallint_to_bool(v)
380   clone(:convert_smallint_to_bool=>v)
381 end