Class: ActiveRecord::ConnectionAdapters::MSSQL::Type::DateTime
- Inherits:
-
Type::DateTime
- Object
- Type::DateTime
- ActiveRecord::ConnectionAdapters::MSSQL::Type::DateTime
- Defined in:
- lib/arjdbc/mssql/types/date_and_time_types.rb
Overview
NOTE: The key here is to get usec in a format like ABC000 to get minimal rounding issues. MSSQL has its own rounding strategy (Rounded to increments of .000, .003, or .007 seconds)
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#type ⇒ Object
49 50 51 |
# File 'lib/arjdbc/mssql/types/date_and_time_types.rb', line 49 def type :datetime_basic end |
#type_cast_for_schema(value) ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/arjdbc/mssql/types/date_and_time_types.rb', line 53 def type_cast_for_schema(value) return %("#{value}") if value.acts_like?(:string) if value.usec > 0 %("#{value.to_s(:db)}.#{value.usec.to_s.remove(/0+$/)}") else %("#{value.to_s(:db)}") end end |