Ticket #7798: ora_datetime.patch
| File ora_datetime.patch, 1.9 kB (added by mschoen, 2 years ago) |
|---|
-
activerecord/lib/active_record/connection_adapters/oracle_adapter.rb
old new 162 162 # camelCase column names need to be quoted; not that anyone using Oracle 163 163 # would really do this, but handling this case means we pass the test... 164 164 def quote_column_name(name) #:nodoc: 165 name =~ /[A-Z]/ ? "\"#{name}\"" : name165 name.to_s =~ /[A-Z]/ ? "\"#{name}\"" : name 166 166 end 167 167 168 168 def quote_string(s) #:nodoc: … … 507 507 when OCI8::LOB 508 508 name == 'Writable Large Object' ? row[i]: row[i].read 509 509 when OraDate 510 if emulate_dates && (row[i].hour == 0 && row[i].minute == 0 && row[i].second == 0) 511 row[i].to_date 510 d = row[i] 511 if emulate_dates && (d.hour == 0 && d.minute == 0 && d.second == 0) 512 d.to_date 512 513 else 513 row[i].to_time rescue row[i].to_datetime 514 # see string_to_time; Time overflowing to DateTime, respecting the default timezone 515 time_array = [d.year, d.month, d.day, d.hour, d.minute, d.second] 516 begin 517 Time.send(Base.default_timezone, *time_array) 518 rescue 519 zone_offset = if Base.default_timezone == :local then DateTime.now.offset else 0 end 520 # Append zero calendar reform start to account for dates skipped by calendar reform 521 DateTime.new(*time_array[0..5] << zone_offset << 0) rescue nil 522 end 514 523 end 515 524 else row[i] 516 525 end unless col == 'raw_rnum_'