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