class Sequel::IBMDB::Dataset
Attributes
convert_smallint_to_bool[W]
Override the default Sequel::IBMDB.convert_smallint_to_bool setting for this dataset.
Public Instance Methods
call(type, bind_arguments={}, *values, &block)
click to toggle source
Emulate support of bind arguments in called statements.
# File lib/sequel/adapters/ibmdb.rb, line 419 def call(type, bind_arguments={}, *values, &block) ps = to_prepared_statement(type, values) ps.extend(CallableStatementMethods) ps.call(bind_arguments, &block) end
convert_smallint_to_bool()
click to toggle source
Whether to convert smallint to boolean arguments for this dataset. Defaults to the IBMDB module setting.
# File lib/sequel/adapters/ibmdb.rb, line 427 def convert_smallint_to_bool defined?(@convert_smallint_to_bool) ? @convert_smallint_to_bool : (@convert_smallint_to_bool = IBMDB.convert_smallint_to_bool) end
fetch_rows(sql) { |row| ... }
click to toggle source
Fetch the rows from the database and yield plain hashes.
# File lib/sequel/adapters/ibmdb.rb, line 435 def fetch_rows(sql) execute(sql) do |stmt| columns = [] convert = convert_smallint_to_bool cps = db.conversion_procs stmt.num_fields.times do |i| k = stmt.field_name i key = output_identifier(k) type = stmt.field_type(i).downcase.to_sym # decide if it is a smallint from precision type = :boolean if type == :int && convert && stmt.field_precision(i) < 8 type = :blob if type == :clob && Sequel::DB2.use_clob_as_blob columns << [key, cps[type]] end cols = columns.map{|c| c.at(0)} @columns = cols while res = stmt.fetch_array row = {} res.zip(columns).each do |v, (k, pr)| row[k] = ((pr ? pr.call(v) : v) if v) end yield row end end self end
prepare(type, name=nil, *values)
click to toggle source
Store the given type of prepared statement in the associated database with the given name.
# File lib/sequel/adapters/ibmdb.rb, line 465 def prepare(type, name=nil, *values) ps = to_prepared_statement(type, values) ps.extend(PreparedStatementMethods) if name ps.prepared_statement_name = name db.set_prepared_statement(name, ps) end ps end