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

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

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 373
373:       def call(type, bind_arguments={}, *values, &block)
374:         ps = to_prepared_statement(type, values)
375:         ps.extend(CallableStatementMethods)
376:         ps.call(bind_arguments, &block)
377:       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 381
381:       def convert_smallint_to_bool
382:         defined?(@convert_smallint_to_bool) ? @convert_smallint_to_bool : (@convert_smallint_to_bool = IBMDB.convert_smallint_to_bool)
383:       end

Fetch the rows from the database and yield plain hashes.

[Source]

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

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

[Source]

     # File lib/sequel/adapters/ibmdb.rb, line 419
419:       def prepare(type, name=nil, *values)
420:         ps = to_prepared_statement(type, values)
421:         ps.extend(PreparedStatementMethods)
422:         if name
423:           ps.prepared_statement_name = name
424:           db.set_prepared_statement(name, ps)
425:         end
426:         ps
427:       end

[Validate]