Class: DBI::DBD::MSSQL::Type::Timestamp
- Inherits:
-
Type::Timestamp
- Object
- Type::Timestamp
- DBI::DBD::MSSQL::Type::Timestamp
- Defined in:
- lib/dbd/mssql/types.rb
Overview
Custom handling for TIMESTAMP and DATETIME types in MySQL. See DBI::Type for more information.
Class Method Summary collapse
Class Method Details
.parse(obj) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/dbd/mssql/types.rb', line 29 def self.parse(obj) case obj when ::DateTime return obj when ::Date return create(obj.year, obj.month, obj.day, 0, 0, 0) when ::Time return create(obj.year, obj.month, obj.day, obj.hour, obj.min, obj.sec, obj.usec, obj.utc_offset / 86400.0) when ::System::DateTime return create(obj.year, obj.month, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond) else obj = super return obj unless obj return create(*parse_string(obj.to_s)) if obj.respond_to? :to_s return create(*parse_string(obj.to_str)) if obj.respond_to? :to_str return obj end end |