# File lib/sequel/adapters/odbc.rb, line 103 103: def fetch_rows(sql) 104: execute(sql) do |s| 105: i = 1 106: cols = s.columns(true).map{|c| [output_identifier(c.name), i+=1]} 107: columns = cols.map{|c| c.at(0)} 108: if opts[:offset] && offset_returns_row_number_column? 109: rn = row_number_column 110: columns.delete(rn) 111: end 112: @columns = columns 113: if rows = s.fetch_all 114: rows.each do |row| 115: hash = {} 116: cols.each{|n,i| hash[n] = convert_odbc_value(row[i])} 117: hash.delete(rn) if rn 118: yield hash 119: end 120: end 121: end 122: self 123: end
# File lib/sequel/adapters/odbc.rb, line 127 127: def convert_odbc_value(v) 128: # When fetching a result set, the Ruby ODBC driver converts all ODBC 129: # SQL types to an equivalent Ruby type; with the exception of 130: # SQL_TYPE_DATE, SQL_TYPE_TIME and SQL_TYPE_TIMESTAMP. 131: # 132: # The conversions below are consistent with the mappings in 133: # ODBCColumn#mapSqlTypeToGenericType and Column#klass. 134: case v 135: when ::ODBC::TimeStamp 136: db.to_application_timestamp([v.year, v.month, v.day, v.hour, v.minute, v.second]) 137: when ::ODBC::Time 138: Sequel::SQLTime.create(v.hour, v.minute, v.second) 139: when ::ODBC::Date 140: Date.new(v.year, v.month, v.day) 141: else 142: v 143: end 144: end
# File lib/sequel/adapters/odbc.rb, line 146 146: def default_timestamp_format 147: TIMESTAMP_FORMAT 148: end
# File lib/sequel/adapters/odbc.rb, line 150 150: def literal_date(v) 151: v.strftime(ODBC_DATE_FORMAT) 152: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.