Class | Sequel::DB2::Dataset |
In: |
lib/sequel/adapters/db2.rb
|
Parent: | Sequel::Dataset |
DatasetClass | = | self |
MAX_COL_SIZE | = | 256 |
convert_smallint_to_bool | [W] | Override the default DB2.convert_smallint_to_bool setting for this dataset. |
Whether to convert smallint to boolean arguments for this dataset. Defaults to the DB2 module setting.
# File lib/sequel/adapters/db2.rb, line 171 171: def convert_smallint_to_bool 172: defined?(@convert_smallint_to_bool) ? @convert_smallint_to_bool : (@convert_smallint_to_bool = DB2.convert_smallint_to_bool) 173: end
# File lib/sequel/adapters/db2.rb, line 178 178: def fetch_rows(sql) 179: execute(sql) do |sth| 180: offset = @opts[:offset] 181: db = @db 182: i = 1 183: column_info = get_column_info(sth) 184: cols = column_info.map{|c| c.at(1)} 185: cols.delete(row_number_column) if offset 186: @columns = cols 187: errors = [DB2CLI::SQL_NO_DATA_FOUND, DB2CLI::SQL_ERROR] 188: until errors.include?(rc = DB2CLI.SQLFetch(sth)) 189: db.check_error(rc, "Could not fetch row") 190: row = {} 191: column_info.each do |i, c, t, s, pr| 192: v, _ = db.checked_error("Could not get data"){DB2CLI.SQLGetData(sth, i, t, s)} 193: row[c] = if v == DB2CLI::Null 194: nil 195: elsif pr 196: pr.call(v) 197: else 198: v 199: end 200: end 201: row.delete(row_number_column) if offset 202: yield row 203: end 204: end 205: self 206: end