Class Sequel::IBMDB::Dataset
In: lib/sequel/adapters/ibmdb.rb
Parent: Sequel::Dataset

Methods

Included Modules

Sequel::DB2::DatasetMethods

Classes and Modules

Module Sequel::IBMDB::Dataset::CallableStatementMethods

Constants

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

Public Instance methods

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

[Source]

     # File lib/sequel/adapters/ibmdb.rb, line 374
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

[Source]

     # File lib/sequel/adapters/ibmdb.rb, line 383
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

Return a cloned dataset with the convert_smallint_to_bool option set.

[Source]

     # File lib/sequel/adapters/ibmdb.rb, line 379
379:       def with_convert_smallint_to_bool(v)
380:         clone(:convert_smallint_to_bool=>v)
381:       end

[Validate]