class Sequel::ODBC::Dataset
def convert_odbc_value(v)
def convert_odbc_value(v) # When fetching a result set, the Ruby ODBC driver converts all ODBC # SQL types to an equivalent Ruby type; with the exception of # SQL_TYPE_DATE, SQL_TYPE_TIME and SQL_TYPE_TIMESTAMP. # # The conversions below are consistent with the mappings in # ODBCColumn#mapSqlTypeToGenericType and Column#klass. case v when ::ODBC::TimeStamp db.to_application_timestamp([v.year, v.month, v.day, v.hour, v.minute, v.second]) when ::ODBC::Time Sequel::SQLTime.create(v.hour, v.minute, v.second) when ::ODBC::Date Date.new(v.year, v.month, v.day) else v end end
def default_timestamp_format
def default_timestamp_format TIMESTAMP_FORMAT end
def fetch_rows(sql)
def fetch_rows(sql) execute(sql) do |s| i = -1 cols = s.columns(true).map{|c| [output_identifier(c.name), i+=1]} columns = cols.map{|c| c.at(0)} if opts[:offset] && offset_returns_row_number_column? rn = row_number_column columns.delete(rn) end @columns = columns if rows = s.fetch_all rows.each do |row| hash = {} cols.each{|n,i| hash[n] = convert_odbc_value(row[i])} hash.delete(rn) if rn yield hash end end end self end
def literal_date(v)
def literal_date(v) v.strftime(ODBC_DATE_FORMAT) end
def literal_false
def literal_false BOOL_FALSE end
def literal_true
def literal_true BOOL_TRUE end