activerecord-jdbcsqlserver-adapter 50.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.travis.yml +27 -0
  4. data/CHANGELOG.md +124 -0
  5. data/CODE_OF_CONDUCT.md +31 -0
  6. data/Dockerfile +20 -0
  7. data/Gemfile +77 -0
  8. data/Guardfile +29 -0
  9. data/MIT-LICENSE +20 -0
  10. data/RAILS5-TODO.md +5 -0
  11. data/README.md +93 -0
  12. data/RUNNING_UNIT_TESTS.md +96 -0
  13. data/Rakefile +46 -0
  14. data/VERSION +1 -0
  15. data/activerecord-jdbcsqlserver-adapter.gemspec +21 -0
  16. data/appveyor.yml +39 -0
  17. data/docker-compose.ci.yml +11 -0
  18. data/lib/active_record/connection_adapters/sqlserver/core_ext/active_record.rb +27 -0
  19. data/lib/active_record/connection_adapters/sqlserver/core_ext/attribute_methods.rb +25 -0
  20. data/lib/active_record/connection_adapters/sqlserver/core_ext/date_time.rb +58 -0
  21. data/lib/active_record/connection_adapters/sqlserver/core_ext/explain.rb +47 -0
  22. data/lib/active_record/connection_adapters/sqlserver/core_ext/explain_subscriber.rb +4 -0
  23. data/lib/active_record/connection_adapters/sqlserver/database_limits.rb +49 -0
  24. data/lib/active_record/connection_adapters/sqlserver/database_statements.rb +362 -0
  25. data/lib/active_record/connection_adapters/sqlserver/database_tasks.rb +67 -0
  26. data/lib/active_record/connection_adapters/sqlserver/errors.rb +7 -0
  27. data/lib/active_record/connection_adapters/sqlserver/jdbc_overrides.rb +192 -0
  28. data/lib/active_record/connection_adapters/sqlserver/quoting.rb +99 -0
  29. data/lib/active_record/connection_adapters/sqlserver/schema_creation.rb +34 -0
  30. data/lib/active_record/connection_adapters/sqlserver/schema_dumper.rb +16 -0
  31. data/lib/active_record/connection_adapters/sqlserver/schema_statements.rb +517 -0
  32. data/lib/active_record/connection_adapters/sqlserver/showplan.rb +66 -0
  33. data/lib/active_record/connection_adapters/sqlserver/showplan/printer_table.rb +66 -0
  34. data/lib/active_record/connection_adapters/sqlserver/showplan/printer_xml.rb +22 -0
  35. data/lib/active_record/connection_adapters/sqlserver/sql_type_metadata.rb +20 -0
  36. data/lib/active_record/connection_adapters/sqlserver/table_definition.rb +112 -0
  37. data/lib/active_record/connection_adapters/sqlserver/transaction.rb +64 -0
  38. data/lib/active_record/connection_adapters/sqlserver/type.rb +49 -0
  39. data/lib/active_record/connection_adapters/sqlserver/type/big_integer.rb +19 -0
  40. data/lib/active_record/connection_adapters/sqlserver/type/binary.rb +21 -0
  41. data/lib/active_record/connection_adapters/sqlserver/type/boolean.rb +15 -0
  42. data/lib/active_record/connection_adapters/sqlserver/type/char.rb +32 -0
  43. data/lib/active_record/connection_adapters/sqlserver/type/data.rb +30 -0
  44. data/lib/active_record/connection_adapters/sqlserver/type/date.rb +61 -0
  45. data/lib/active_record/connection_adapters/sqlserver/type/datetime.rb +71 -0
  46. data/lib/active_record/connection_adapters/sqlserver/type/datetime2.rb +17 -0
  47. data/lib/active_record/connection_adapters/sqlserver/type/datetimeoffset.rb +23 -0
  48. data/lib/active_record/connection_adapters/sqlserver/type/decimal.rb +21 -0
  49. data/lib/active_record/connection_adapters/sqlserver/type/float.rb +19 -0
  50. data/lib/active_record/connection_adapters/sqlserver/type/integer.rb +15 -0
  51. data/lib/active_record/connection_adapters/sqlserver/type/json.rb +11 -0
  52. data/lib/active_record/connection_adapters/sqlserver/type/money.rb +25 -0
  53. data/lib/active_record/connection_adapters/sqlserver/type/real.rb +19 -0
  54. data/lib/active_record/connection_adapters/sqlserver/type/small_integer.rb +15 -0
  55. data/lib/active_record/connection_adapters/sqlserver/type/small_money.rb +25 -0
  56. data/lib/active_record/connection_adapters/sqlserver/type/smalldatetime.rb +29 -0
  57. data/lib/active_record/connection_adapters/sqlserver/type/string.rb +12 -0
  58. data/lib/active_record/connection_adapters/sqlserver/type/text.rb +19 -0
  59. data/lib/active_record/connection_adapters/sqlserver/type/time.rb +68 -0
  60. data/lib/active_record/connection_adapters/sqlserver/type/time_value_fractional.rb +93 -0
  61. data/lib/active_record/connection_adapters/sqlserver/type/timestamp.rb +19 -0
  62. data/lib/active_record/connection_adapters/sqlserver/type/tiny_integer.rb +25 -0
  63. data/lib/active_record/connection_adapters/sqlserver/type/unicode_char.rb +21 -0
  64. data/lib/active_record/connection_adapters/sqlserver/type/unicode_string.rb +12 -0
  65. data/lib/active_record/connection_adapters/sqlserver/type/unicode_text.rb +19 -0
  66. data/lib/active_record/connection_adapters/sqlserver/type/unicode_varchar.rb +26 -0
  67. data/lib/active_record/connection_adapters/sqlserver/type/unicode_varchar_max.rb +24 -0
  68. data/lib/active_record/connection_adapters/sqlserver/type/uuid.rb +36 -0
  69. data/lib/active_record/connection_adapters/sqlserver/type/varbinary.rb +26 -0
  70. data/lib/active_record/connection_adapters/sqlserver/type/varbinary_max.rb +24 -0
  71. data/lib/active_record/connection_adapters/sqlserver/type/varchar.rb +26 -0
  72. data/lib/active_record/connection_adapters/sqlserver/type/varchar_max.rb +24 -0
  73. data/lib/active_record/connection_adapters/sqlserver/utils.rb +146 -0
  74. data/lib/active_record/connection_adapters/sqlserver/version.rb +11 -0
  75. data/lib/active_record/connection_adapters/sqlserver_adapter.rb +445 -0
  76. data/lib/active_record/connection_adapters/sqlserver_column.rb +28 -0
  77. data/lib/active_record/jdbc_sqlserver_connection_methods.rb +31 -0
  78. data/lib/active_record/sqlserver_base.rb +16 -0
  79. data/lib/active_record/tasks/sqlserver_database_tasks.rb +131 -0
  80. data/lib/activerecord-jdbcsqlserver-adapter.rb +24 -0
  81. data/lib/activerecord-sqlserver-adapter.rb +1 -0
  82. data/lib/arel/visitors/sqlserver.rb +205 -0
  83. data/lib/arel_sqlserver.rb +3 -0
  84. data/test/appveyor/dbsetup.ps1 +27 -0
  85. data/test/appveyor/dbsetup.sql +11 -0
  86. data/test/bin/wait-for.sh +79 -0
  87. data/test/cases/adapter_test_sqlserver.rb +430 -0
  88. data/test/cases/coerced_tests.rb +845 -0
  89. data/test/cases/column_test_sqlserver.rb +812 -0
  90. data/test/cases/connection_test_sqlserver.rb +71 -0
  91. data/test/cases/execute_procedure_test_sqlserver.rb +45 -0
  92. data/test/cases/fetch_test_sqlserver.rb +57 -0
  93. data/test/cases/fully_qualified_identifier_test_sqlserver.rb +76 -0
  94. data/test/cases/helper_sqlserver.rb +44 -0
  95. data/test/cases/index_test_sqlserver.rb +47 -0
  96. data/test/cases/json_test_sqlserver.rb +32 -0
  97. data/test/cases/migration_test_sqlserver.rb +61 -0
  98. data/test/cases/order_test_sqlserver.rb +147 -0
  99. data/test/cases/pessimistic_locking_test_sqlserver.rb +94 -0
  100. data/test/cases/rake_test_sqlserver.rb +169 -0
  101. data/test/cases/schema_dumper_test_sqlserver.rb +234 -0
  102. data/test/cases/schema_test_sqlserver.rb +54 -0
  103. data/test/cases/scratchpad_test_sqlserver.rb +8 -0
  104. data/test/cases/showplan_test_sqlserver.rb +65 -0
  105. data/test/cases/specific_schema_test_sqlserver.rb +180 -0
  106. data/test/cases/transaction_test_sqlserver.rb +91 -0
  107. data/test/cases/utils_test_sqlserver.rb +129 -0
  108. data/test/cases/uuid_test_sqlserver.rb +49 -0
  109. data/test/config.yml +38 -0
  110. data/test/debug.rb +14 -0
  111. data/test/fixtures/1px.gif +0 -0
  112. data/test/migrations/transaction_table/1_table_will_never_be_created.rb +11 -0
  113. data/test/models/sqlserver/booking.rb +3 -0
  114. data/test/models/sqlserver/customers_view.rb +3 -0
  115. data/test/models/sqlserver/datatype.rb +3 -0
  116. data/test/models/sqlserver/datatype_migration.rb +8 -0
  117. data/test/models/sqlserver/dollar_table_name.rb +3 -0
  118. data/test/models/sqlserver/dot_table_name.rb +3 -0
  119. data/test/models/sqlserver/edge_schema.rb +13 -0
  120. data/test/models/sqlserver/fk_has_fk.rb +3 -0
  121. data/test/models/sqlserver/fk_has_pk.rb +3 -0
  122. data/test/models/sqlserver/natural_pk_data.rb +4 -0
  123. data/test/models/sqlserver/natural_pk_int_data.rb +3 -0
  124. data/test/models/sqlserver/no_pk_data.rb +3 -0
  125. data/test/models/sqlserver/object_default.rb +3 -0
  126. data/test/models/sqlserver/quoted_table.rb +7 -0
  127. data/test/models/sqlserver/quoted_view_1.rb +3 -0
  128. data/test/models/sqlserver/quoted_view_2.rb +3 -0
  129. data/test/models/sqlserver/sst_memory.rb +3 -0
  130. data/test/models/sqlserver/string_default.rb +3 -0
  131. data/test/models/sqlserver/string_defaults_big_view.rb +3 -0
  132. data/test/models/sqlserver/string_defaults_view.rb +3 -0
  133. data/test/models/sqlserver/tinyint_pk.rb +3 -0
  134. data/test/models/sqlserver/upper.rb +3 -0
  135. data/test/models/sqlserver/uppered.rb +3 -0
  136. data/test/models/sqlserver/uuid.rb +3 -0
  137. data/test/schema/datatypes/2012.sql +55 -0
  138. data/test/schema/enable-in-memory-oltp.sql +81 -0
  139. data/test/schema/sqlserver_specific_schema.rb +238 -0
  140. data/test/support/coerceable_test_sqlserver.rb +49 -0
  141. data/test/support/connection_reflection.rb +34 -0
  142. data/test/support/load_schema_sqlserver.rb +29 -0
  143. data/test/support/minitest_sqlserver.rb +1 -0
  144. data/test/support/paths_sqlserver.rb +50 -0
  145. data/test/support/rake_helpers.rb +41 -0
  146. data/test/support/sql_counter_sqlserver.rb +28 -0
  147. data/test/support/test_in_memory_oltp.rb +15 -0
  148. metadata +310 -0
@@ -0,0 +1,66 @@
1
+ require 'active_record/connection_adapters/sqlserver/showplan/printer_table'
2
+ require 'active_record/connection_adapters/sqlserver/showplan/printer_xml'
3
+
4
+ module ActiveRecord
5
+ module ConnectionAdapters
6
+ module SQLServer
7
+ module Showplan
8
+
9
+ OPTION_ALL = 'SHOWPLAN_ALL'
10
+ OPTION_TEXT = 'SHOWPLAN_TEXT'
11
+ OPTION_XML = 'SHOWPLAN_XML'
12
+ OPTIONS = [OPTION_ALL, OPTION_TEXT, OPTION_XML]
13
+
14
+ def explain(arel, binds = [])
15
+ sql = to_sql(arel)
16
+ result = with_showplan_on { sp_executesql(sql, 'EXPLAIN', binds) }
17
+ printer = showplan_printer.new(result)
18
+ printer.pp
19
+ end
20
+
21
+ protected
22
+
23
+ def with_showplan_on
24
+ set_showplan_option(true)
25
+ yield
26
+ ensure
27
+ set_showplan_option(false)
28
+ end
29
+
30
+ def set_showplan_option(enable = true)
31
+ sql = "SET #{showplan_option} #{enable ? 'ON' : 'OFF'}"
32
+ raw_connection_do(sql)
33
+ rescue Exception
34
+ raise ActiveRecordError, "#{showplan_option} could not be turned #{enable ? 'ON' : 'OFF'}, perhaps you do not have SHOWPLAN permissions?"
35
+ end
36
+
37
+ def showplan_option
38
+ (SQLServerAdapter.showplan_option || OPTION_ALL).tap do |opt|
39
+ raise(ArgumentError, "Unknown SHOWPLAN option #{opt.inspect} found.") if OPTIONS.exclude?(opt)
40
+ end
41
+ end
42
+
43
+ def showplan_all?
44
+ showplan_option == OPTION_ALL
45
+ end
46
+
47
+ def showplan_text?
48
+ showplan_option == OPTION_TEXT
49
+ end
50
+
51
+ def showplan_xml?
52
+ showplan_option == OPTION_XML
53
+ end
54
+
55
+ def showplan_printer
56
+ case showplan_option
57
+ when OPTION_XML then PrinterXml
58
+ when OPTION_ALL, OPTION_TEXT then PrinterTable
59
+ else PrinterTable
60
+ end
61
+ end
62
+
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,66 @@
1
+ module ActiveRecord
2
+ module ConnectionAdapters
3
+ module SQLServer
4
+ module Showplan
5
+ class PrinterTable
6
+ cattr_accessor :max_column_width, :cell_padding
7
+ self.max_column_width = 50
8
+ self.cell_padding = 1
9
+
10
+ attr_reader :result
11
+
12
+ def initialize(result)
13
+ @result = result
14
+ end
15
+
16
+ def pp
17
+ @widths = compute_column_widths
18
+ @separator = build_separator
19
+ pp = []
20
+ pp << @separator
21
+ pp << build_cells(result.columns)
22
+ pp << @separator
23
+ result.rows.each do |row|
24
+ pp << build_cells(row)
25
+ end
26
+ pp << @separator
27
+ pp.join("\n") + "\n"
28
+ end
29
+
30
+ private
31
+
32
+ def compute_column_widths
33
+ [].tap do |computed_widths|
34
+ result.columns.each_with_index do |column, i|
35
+ cells_in_column = [column] + result.rows.map { |r| cast_item(r[i]) }
36
+ computed_width = cells_in_column.map(&:length).max
37
+ final_width = computed_width > max_column_width ? max_column_width : computed_width
38
+ computed_widths << final_width
39
+ end
40
+ end
41
+ end
42
+
43
+ def build_separator
44
+ '+' + @widths.map { |w| '-' * (w + (cell_padding * 2)) }.join('+') + '+'
45
+ end
46
+
47
+ def build_cells(items)
48
+ cells = []
49
+ items.each_with_index do |item, i|
50
+ cells << cast_item(item).ljust(@widths[i])
51
+ end
52
+ "| #{cells.join(' | ')} |"
53
+ end
54
+
55
+ def cast_item(item)
56
+ case item
57
+ when NilClass then 'NULL'
58
+ when Float then item.to_s.to(9)
59
+ else item.to_s.truncate(max_column_width)
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,22 @@
1
+ module ActiveRecord
2
+ module ConnectionAdapters
3
+ module SQLServer
4
+ module Showplan
5
+ class PrinterXml
6
+ def initialize(result)
7
+ @result = result
8
+ end
9
+
10
+ def pp
11
+ xml = @result.rows.first.first
12
+ if defined?(Nokogiri)
13
+ Nokogiri::XML(xml).to_xml indent: 2, encoding: 'UTF-8'
14
+ else
15
+ xml
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,20 @@
1
+ module ActiveRecord
2
+ module ConnectionAdapters
3
+ module SQLServer
4
+ class SqlTypeMetadata < ActiveRecord::ConnectionAdapters::SqlTypeMetadata
5
+
6
+ def initialize(**kwargs)
7
+ @sqlserver_options = kwargs.extract!(:sqlserver_options)
8
+ super(**kwargs)
9
+ end
10
+
11
+ protected
12
+
13
+ def attributes_for_hash
14
+ super + [@sqlserver_options]
15
+ end
16
+
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,112 @@
1
+ module ActiveRecord
2
+ module ConnectionAdapters
3
+ module SQLServer
4
+
5
+ module ColumnMethods
6
+
7
+ def primary_key(name, type = :primary_key, **options)
8
+ return super unless type == :uuid
9
+ options[:default] = options.fetch(:default, 'NEWID()')
10
+ options[:primary_key] = true
11
+ column name, type, options
12
+ end
13
+
14
+ def primary_key_nonclustered(*args, **options)
15
+ args.each { |name| column(name, :primary_key_nonclustered, options) }
16
+ end
17
+
18
+ def real(*args, **options)
19
+ args.each { |name| column(name, :real, options) }
20
+ end
21
+
22
+ def money(*args, **options)
23
+ args.each { |name| column(name, :money, options) }
24
+ end
25
+
26
+ def smalldatetime(*args, **options)
27
+ args.each { |name| column(name, :smalldatetime, options) }
28
+ end
29
+
30
+ def datetime(*args, **options)
31
+ args.each do |name|
32
+ if options[:precision]
33
+ datetime2(name, options)
34
+ else
35
+ column(name, :datetime, options)
36
+ end
37
+ end
38
+ end
39
+
40
+ def datetime2(*args, **options)
41
+ args.each { |name| column(name, :datetime2, options) }
42
+ end
43
+
44
+ def datetimeoffset(*args, **options)
45
+ args.each { |name| column(name, :datetimeoffset, options) }
46
+ end
47
+
48
+ def smallmoney(*args, **options)
49
+ args.each { |name| column(name, :smallmoney, options) }
50
+ end
51
+
52
+ def char(*args, **options)
53
+ args.each { |name| column(name, :char, options) }
54
+ end
55
+
56
+ def varchar(*args, **options)
57
+ args.each { |name| column(name, :varchar, options) }
58
+ end
59
+
60
+ def varchar_max(*args, **options)
61
+ args.each { |name| column(name, :varchar_max, options) }
62
+ end
63
+
64
+ def text_basic(*args, **options)
65
+ args.each { |name| column(name, :text_basic, options) }
66
+ end
67
+
68
+ def nchar(*args, **options)
69
+ args.each { |name| column(name, :nchar, options) }
70
+ end
71
+
72
+ def ntext(*args, **options)
73
+ args.each { |name| column(name, :ntext, options) }
74
+ end
75
+
76
+ def binary_basic(*args, **options)
77
+ args.each { |name| column(name, :binary_basic, options) }
78
+ end
79
+
80
+ def varbinary(*args, **options)
81
+ args.each { |name| column(name, :varbinary, options) }
82
+ end
83
+
84
+ def uuid(*args, **options)
85
+ args.each { |name| column(name, :uniqueidentifier, options) }
86
+ end
87
+
88
+ def ss_timestamp(*args, **options)
89
+ args.each { |name| column(name, :ss_timestamp, options) }
90
+ end
91
+
92
+ def json(*args, **options)
93
+ args.each { |name| column(name, :text, options) }
94
+ end
95
+
96
+ end
97
+
98
+ class TableDefinition < ActiveRecord::ConnectionAdapters::TableDefinition
99
+ include ColumnMethods
100
+
101
+ def new_column_definition(name, type, options)
102
+ type = :datetime2 if type == :datetime && options[:precision]
103
+ super name, type, options
104
+ end
105
+ end
106
+
107
+ class Table < ActiveRecord::ConnectionAdapters::Table
108
+ include ColumnMethods
109
+ end
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,64 @@
1
+ require 'active_record/connection_adapters/abstract/transaction'
2
+
3
+ module ActiveRecord
4
+ module ConnectionAdapters
5
+
6
+ module SQLServerTransaction
7
+
8
+ private
9
+
10
+ def sqlserver?
11
+ connection.respond_to?(:sqlserver?) && connection.sqlserver?
12
+ end
13
+
14
+ def current_isolation_level
15
+ return unless sqlserver?
16
+ level = connection.user_options_isolation_level
17
+ # When READ_COMMITTED_SNAPSHOT is set to ON,
18
+ # user_options_isolation_level will be equal to 'read committed
19
+ # snapshot' which is not a valid isolation level
20
+ if level.blank? || level == 'read committed snapshot'
21
+ 'READ COMMITTED'
22
+ else
23
+ level.upcase
24
+ end
25
+ end
26
+
27
+ end
28
+
29
+ Transaction.send :include, SQLServerTransaction
30
+
31
+ module SQLServerRealTransaction
32
+
33
+ attr_reader :starting_isolation_level
34
+
35
+ def initialize(connection, options, run_commit_callbacks: false)
36
+ @connection = connection
37
+ @starting_isolation_level = current_isolation_level if options[:isolation]
38
+ super
39
+ end
40
+
41
+ def commit
42
+ super
43
+ reset_starting_isolation_level
44
+ end
45
+
46
+ def rollback
47
+ super
48
+ reset_starting_isolation_level
49
+ end
50
+
51
+ private
52
+
53
+ def reset_starting_isolation_level
54
+ if sqlserver? && starting_isolation_level
55
+ connection.set_transaction_isolation_level(starting_isolation_level)
56
+ end
57
+ end
58
+
59
+ end
60
+
61
+ RealTransaction.send :include, SQLServerRealTransaction
62
+
63
+ end
64
+ end
@@ -0,0 +1,49 @@
1
+ require 'active_record/type'
2
+ # Behaviors
3
+ require 'active_record/connection_adapters/sqlserver/type/data'
4
+ require 'active_record/connection_adapters/sqlserver/type/time_value_fractional'
5
+ # Exact Numerics
6
+ require 'active_record/connection_adapters/sqlserver/type/integer'
7
+ require 'active_record/connection_adapters/sqlserver/type/big_integer'
8
+ require 'active_record/connection_adapters/sqlserver/type/small_integer'
9
+ require 'active_record/connection_adapters/sqlserver/type/tiny_integer'
10
+ require 'active_record/connection_adapters/sqlserver/type/boolean'
11
+ require 'active_record/connection_adapters/sqlserver/type/decimal'
12
+ require 'active_record/connection_adapters/sqlserver/type/money'
13
+ require 'active_record/connection_adapters/sqlserver/type/small_money'
14
+ # Approximate Numerics
15
+ require 'active_record/connection_adapters/sqlserver/type/float'
16
+ require 'active_record/connection_adapters/sqlserver/type/real'
17
+ # Date and Time
18
+ require 'active_record/connection_adapters/sqlserver/type/date'
19
+ require 'active_record/connection_adapters/sqlserver/type/datetime'
20
+ require 'active_record/connection_adapters/sqlserver/type/datetime2'
21
+ require 'active_record/connection_adapters/sqlserver/type/datetimeoffset'
22
+ require 'active_record/connection_adapters/sqlserver/type/smalldatetime'
23
+ require 'active_record/connection_adapters/sqlserver/type/time'
24
+ # Character Strings
25
+ require 'active_record/connection_adapters/sqlserver/type/string'
26
+ require 'active_record/connection_adapters/sqlserver/type/char'
27
+ require 'active_record/connection_adapters/sqlserver/type/varchar'
28
+ require 'active_record/connection_adapters/sqlserver/type/varchar_max'
29
+ require 'active_record/connection_adapters/sqlserver/type/text'
30
+ # Unicode Character Strings
31
+ require 'active_record/connection_adapters/sqlserver/type/unicode_string'
32
+ require 'active_record/connection_adapters/sqlserver/type/unicode_char'
33
+ require 'active_record/connection_adapters/sqlserver/type/unicode_varchar'
34
+ require 'active_record/connection_adapters/sqlserver/type/unicode_varchar_max'
35
+ require 'active_record/connection_adapters/sqlserver/type/unicode_text'
36
+ # Binary Strings
37
+ require 'active_record/connection_adapters/sqlserver/type/binary'
38
+ require 'active_record/connection_adapters/sqlserver/type/varbinary'
39
+ require 'active_record/connection_adapters/sqlserver/type/varbinary_max'
40
+ # Other Data Types
41
+ require 'active_record/connection_adapters/sqlserver/type/uuid'
42
+ require 'active_record/connection_adapters/sqlserver/type/timestamp'
43
+ require 'active_record/connection_adapters/sqlserver/type/json'
44
+
45
+ module ActiveRecord
46
+ module Type
47
+ SQLServer = ConnectionAdapters::SQLServer::Type
48
+ end
49
+ end
@@ -0,0 +1,19 @@
1
+ module ActiveRecord
2
+ module ConnectionAdapters
3
+ module SQLServer
4
+ module Type
5
+ class BigInteger < Integer
6
+
7
+ def type
8
+ :bigint
9
+ end
10
+
11
+ def sqlserver_type
12
+ 'bigint'.freeze
13
+ end
14
+
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,21 @@
1
+ module ActiveRecord
2
+ module ConnectionAdapters
3
+ module SQLServer
4
+ module Type
5
+ class Binary < ActiveRecord::Type::Binary
6
+
7
+ def type
8
+ :binary_basic
9
+ end
10
+
11
+ def sqlserver_type
12
+ 'binary'.tap do |type|
13
+ type << "(#{limit})" if limit
14
+ end
15
+ end
16
+
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end