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 174 174: def convert_smallint_to_bool 175: defined?(@convert_smallint_to_bool) ? @convert_smallint_to_bool : (@convert_smallint_to_bool = DB2.convert_smallint_to_bool) 176: end
# File lib/sequel/adapters/db2.rb, line 181 181: def fetch_rows(sql) 182: execute(sql) do |sth| 183: db = @db 184: i = 1 185: column_info = get_column_info(sth) 186: cols = column_info.map{|c| c.at(1)} 187: @columns = cols 188: errors = [DB2CLI::SQL_NO_DATA_FOUND, DB2CLI::SQL_ERROR] 189: until errors.include?(rc = DB2CLI.SQLFetch(sth)) 190: db.check_error(rc, "Could not fetch row") 191: row = {} 192: column_info.each do |i, c, t, s, pr| 193: v, _ = db.checked_error("Could not get data"){DB2CLI.SQLGetData(sth, i, t, s)} 194: row[c] = if v == DB2CLI::Null 195: nil 196: elsif pr 197: pr.call(v) 198: else 199: v 200: end 201: end 202: yield row 203: end 204: end 205: self 206: end