Included Modules

Class/Module Index [+]

Quicksearch

Sequel::DB2::Dataset

Attributes

convert_smallint_to_bool[W]

Override the default DB2.convert_smallint_to_bool setting for this dataset.

Public Instance Methods

convert_smallint_to_bool() click to toggle source

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

# File lib/sequel/adapters/db2.rb, line 178
def convert_smallint_to_bool
  defined?(@convert_smallint_to_bool) ? @convert_smallint_to_bool : (@convert_smallint_to_bool = DB2.convert_smallint_to_bool)
end
fetch_rows(sql) click to toggle source
# File lib/sequel/adapters/db2.rb, line 185
def fetch_rows(sql)
  execute(sql) do |sth|
    db = @db
    i = 1
    column_info = get_column_info(sth)
    cols = column_info.map{|c| c.at(1)}
    @columns = cols
    errors = [DB2CLI::SQL_NO_DATA_FOUND, DB2CLI::SQL_ERROR]
    until errors.include?(rc = DB2CLI.SQLFetch(sth))
      db.check_error(rc, "Could not fetch row")
      row = {}
      column_info.each do |i, c, t, s, pr|
        v, _ = db.checked_error("Could not get data"){DB2CLI.SQLGetData(sth, i, t, s)}
        row[c] = if v == DB2CLI::Null
          nil
        elsif pr
          pr.call(v)
        else
          v
        end
      end
      yield row
    end
  end
  self
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.