Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support 2008 Datatypes Using TDSVER=7.3. Fixes #433
* All datetime casting uses the `Time::DATE_FORMATS[:_sqlserver_*]` formats set after connection. * Removed `SQLServer::Utils.with_sqlserver_db_date_formats` helper and `quoted_date` hacks. * Removed `Quoter` value type which allowed column => type special case quoting. cc @sgrif * Every time datatype has perfect micro/nano second handling. Includes schema dumping support.
- Loading branch information
1 parent
c33ebc2
commit 5342848
Showing
22 changed files
with
436 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
lib/active_record/connection_adapters/sqlserver/type/datetime2.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module ActiveRecord | ||
module ConnectionAdapters | ||
module SQLServer | ||
module Type | ||
class DateTime2 < DateTime | ||
|
||
include TimeValueFractional2 | ||
|
||
def type | ||
:datetime2 | ||
end | ||
|
||
end | ||
end | ||
end | ||
end | ||
end |
31 changes: 31 additions & 0 deletions
31
lib/active_record/connection_adapters/sqlserver/type/datetimeoffset.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module ActiveRecord | ||
module ConnectionAdapters | ||
module SQLServer | ||
module Type | ||
class DateTimeOffset < DateTime2 | ||
|
||
def type | ||
:datetimeoffset | ||
end | ||
|
||
def type_cast_for_database(value) | ||
return super unless value.acts_like?(:time) | ||
value.to_s :_sqlserver_datetimeoffset | ||
end | ||
|
||
def type_cast_for_schema(value) | ||
type_cast_for_database(value).inspect | ||
end | ||
|
||
|
||
private | ||
|
||
def zone_conversion(value) | ||
value | ||
end | ||
|
||
end | ||
end | ||
end | ||
end | ||
end |
32 changes: 0 additions & 32 deletions
32
lib/active_record/connection_adapters/sqlserver/type/quoter.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.