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