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
Module Sequel::IBMDB::Dataset::PreparedStatementMethods

Constants

DatasetClass = self

Attributes

convert_smallint_to_bool  [W]  Override the default IBMDB.convert_smallint_to_bool setting for this dataset.

Public Instance methods

Emulate support of bind arguments in called statements.

[Source]

     # File lib/sequel/adapters/ibmdb.rb, line 419
419:       def call(type, bind_arguments={}, *values, &block)
420:         ps = to_prepared_statement(type, values)
421:         ps.extend(CallableStatementMethods)
422:         ps.call(bind_arguments, &block)
423:       end

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

[Source]

     # File lib/sequel/adapters/ibmdb.rb, line 427
427:       def convert_smallint_to_bool
428:         defined?(@convert_smallint_to_bool) ? @convert_smallint_to_bool : (@convert_smallint_to_bool = IBMDB.convert_smallint_to_bool)
429:       end

Fetch the rows from the database and yield plain hashes.

[Source]

     # File lib/sequel/adapters/ibmdb.rb, line 435
435:       def fetch_rows(sql)
436:         execute(sql) do |stmt|
437:           columns = []
438:           convert = convert_smallint_to_bool
439:           cps = db.conversion_procs
440:           stmt.num_fields.times do |i|
441:             k = stmt.field_name i
442:             key = output_identifier(k)
443:             type = stmt.field_type(i).downcase.to_sym
444:             # decide if it is a smallint from precision
445:             type = :boolean  if type == :int && convert && stmt.field_precision(i) < 8
446:             type = :blob if type == :clob && Sequel::DB2.use_clob_as_blob
447:             columns << [key, cps[type]]
448:           end
449:           cols = columns.map{|c| c.at(0)}
450:           @columns = cols
451: 
452:           while res = stmt.fetch_array
453:             row = {}
454:             res.zip(columns).each do |v, (k, pr)|
455:               row[k] = ((pr ? pr.call(v) : v) if v)
456:             end
457:             yield row
458:           end
459:         end
460:         self
461:       end

Store the given type of prepared statement in the associated database with the given name.

[Source]

     # File lib/sequel/adapters/ibmdb.rb, line 465
465:       def prepare(type, name=nil, *values)
466:         ps = to_prepared_statement(type, values)
467:         ps.extend(PreparedStatementMethods)
468:         if name
469:           ps.prepared_statement_name = name
470:           db.set_prepared_statement(name, ps)
471:         end
472:         ps
473:       end

[Validate]