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,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d264fa23b69908328c1e4f17fc5b69b2d2de67ed14394ef5127e9767379ccfe9
4
+ data.tar.gz: c9fa8ecde64528237123e97bf8ed99a26d03d9d83341e7510f3d67d8de4b2b63
5
+ SHA512:
6
+ metadata.gz: ce260ce665bbde6fabeacef58e7b7a4d417e1b453d46c440942c0dba50caf0acbe764932cfa23fc45cb468753e9cd681e88be58f30f1b8ff7e6830c5404eff6b
7
+ data.tar.gz: c17157b072dae81728644a308b89dc401e623d277db94be9f246f5a1b986e63becec559decb4af2a504de961213dc1c026d61a38cf0f908dc1157768523d01b5
@@ -0,0 +1,15 @@
1
+ nbproject/
2
+ debug.log
3
+ .DS_Store
4
+ pkg/
5
+ doc/
6
+ *.gem
7
+ .bundle
8
+ Gemfile.lock
9
+ test/profile/output/*
10
+ .rvmrc
11
+ .rbenv-version
12
+ .idea
13
+ coverage/*
14
+ .flooignore
15
+ .floo
@@ -0,0 +1,27 @@
1
+ sudo: required
2
+ cache: bundler
3
+ services:
4
+ - docker
5
+ env:
6
+ global:
7
+ - COMPOSE_FILE=docker-compose.ci.yml
8
+ #- ARJDBC_BRANCH=mssql-support
9
+ matrix:
10
+ - TARGET_VERSION=9.1
11
+ - TARGET_VERSION=9.2
12
+ branches:
13
+ only:
14
+ - /.*-stable-jdbc$/
15
+ before_install:
16
+ - sudo rm /usr/local/bin/docker-compose
17
+ - sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
18
+ - sudo chmod +x /usr/local/bin/docker-compose
19
+ install:
20
+ - docker-compose build --build-arg TARGET_VERSION=$TARGET_VERSION-jdk-alpine
21
+ #- docker-compose build --build-arg TARGET_VERSION=$TARGET_VERSION-jdk-alpine --build-arg TARGET_ARJDBC_BRANCH=$ARJDBC_BRANCH
22
+ script:
23
+ - docker-compose run ci
24
+ matrix:
25
+ allow_failures:
26
+ - env: TARGET_VERSION=9.1
27
+
@@ -0,0 +1,124 @@
1
+ ## v50.0.0
2
+
3
+ * Forked original gem to provide JRuby support
4
+
5
+ ## v5.0.8
6
+
7
+ * Memorized SQL Server Version to prevent a flood of SELECT @@version queries. Fixes #632
8
+
9
+ ## v5.0.7
10
+
11
+ * Add `WITH NO_INFOMSGS` to `user_options` method. Fixes #580
12
+
13
+
14
+ ## v5.0.6
15
+
16
+ #### Fixed
17
+
18
+ * Performance w/inserts. Check binds & use schema cache for id inserts.
19
+ Fixes #572. Thanks @noelr.
20
+ * Add smalldatetime type for migrations. Fixes #507
21
+
22
+ #### Changed
23
+
24
+ * Misc index enhancements or testing. Fixes #570
25
+ Enable `supports_index_sort_order?`, test `supports_partial_index?`, test how expression indexes work.
26
+
27
+ #### Added
28
+
29
+ * New `primary_key_nonclustered` type for easy In-Memory table creation.
30
+ * Examples for an In-Memory table.
31
+
32
+ ```ruby
33
+ create_table :in_memory_table, id: false,
34
+ options: 'WITH (MEMORY_OPTIMIZED = ON, DURABILITY = SCHEMA_AND_DATA)' do |t|
35
+ t.primary_key_nonclustered :id
36
+ t.string :name
37
+ t.timestamps
38
+ end
39
+ ```
40
+
41
+ * Enable supports_json? Fixes #577.
42
+
43
+ ```ruby
44
+ create_table :users do |t|
45
+ t.string :name, :email
46
+ t.json :data # Creates a nvarchar(max) column.
47
+ end
48
+
49
+ class Users < ActiveRecord::Base
50
+ attribute :data, ActiveRecord::Type::SQLServer::Json.new
51
+ end
52
+
53
+ User.create! name: 'Ken Collins', data: { 'admin' => true, 'foo' => 'bar' }
54
+
55
+ admin = User.where("JSON_VALUE(data, '$.admin') = CAST(1 AS BIT)").first
56
+ admin.data['foo'] # => "bar"
57
+ ```
58
+
59
+
60
+ ## v5.0.5
61
+
62
+ #### Changed
63
+
64
+ * Add TinyTDS as a runtime dependency.
65
+
66
+
67
+ ## v5.0.4
68
+
69
+ #### Fixed
70
+
71
+ * Allow `datetimeoffset` to be used in migrations and represented in schema.
72
+ * Using transactions and resetting isolation level correctly when `READ_COMMITTED_SNAPSHOT` is set to `ON` Fixes #520
73
+
74
+
75
+ ## v5.0.3
76
+
77
+ #### Changed
78
+
79
+ * Reduce view information reflection to per table vs. column. Fixes #552
80
+ * The `user_options` parsing. Works for hash/array. Fixes #535
81
+ * Pass the `:contained` option to TinyTDS. Fixes #527
82
+
83
+
84
+ ## v5.0.2
85
+
86
+ #### Fixed
87
+
88
+ * Filter table constraints with matching table schema to column. Fixes #478
89
+
90
+
91
+ ## v5.0.1
92
+
93
+ #### Changed
94
+
95
+ * Set `tds_version` fallback to `7.3`.
96
+
97
+ #### Fixed
98
+
99
+ * Support 2014, 2012 drop table statement.
100
+
101
+
102
+ ## v5.0.0
103
+
104
+ #### Added
105
+
106
+ * Support for `supports_datetime_with_precision`.
107
+ * Support for `unprepared_statement` blocks on the connection.
108
+
109
+ #### Changed
110
+
111
+ * Major refactoring of all type objects. Especially time types.
112
+
113
+ #### Deprecated
114
+
115
+ * Support for a handful of standard Rails deprecations in 5-0-stable suite.
116
+
117
+ #### Removed
118
+
119
+ * ODBC connection mode. Not been maintained since Rails 4.0.
120
+ * View table name detection in `with_identity_insert_enabled` method for fixtures. Perf hit.
121
+
122
+ #### Fixed
123
+
124
+ * Do not output column collation in schema when same as database.
@@ -0,0 +1,31 @@
1
+ Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all
4
+ people who contribute through reporting issues, posting feature requests,
5
+ updating documentation, submitting pull requests or patches, and other
6
+ activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, or religion.
12
+
13
+ Examples of unacceptable behavior by participants include the use of sexual
14
+ language or imagery, derogatory comments or personal attacks, trolling, public
15
+ or private harassment, insults, or other unprofessional conduct.
16
+
17
+ Project maintainers have the right and responsibility to remove, edit, or
18
+ reject comments, commits, code, wiki edits, issues, and other contributions
19
+ that are not aligned to this Code of Conduct. Project maintainers who do not
20
+ follow the Code of Conduct may be removed from the project team.
21
+
22
+ This code of conduct applies both within project spaces and in public spaces
23
+ when an individual is representing the project or its community.
24
+
25
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
26
+ reported by opening an issue or contacting one or more of the project
27
+ maintainers.
28
+
29
+ This Code of Conduct is adapted from the Contributor Covenant
30
+ (http://contributor-covenant.org), version 1.1.0, available at
31
+ http://contributor-covenant.org/version/1/1/0/
@@ -0,0 +1,20 @@
1
+ ARG TARGET_VERSION=9.2-alpine
2
+
3
+ FROM jruby:${TARGET_VERSION}
4
+
5
+ ENV WORKDIR /activerecord-sqlserver-adapter
6
+ ENV JRUBY_OPTS '--debug -X+O -J-Xmx1G'
7
+
8
+ RUN mkdir -p $WORKDIR
9
+ WORKDIR $WORKDIR
10
+
11
+ COPY . $WORKDIR
12
+
13
+ RUN apk add --no-cache git freetds
14
+
15
+ ARG TARGET_ARJDBC_BRANCH=50-stable
16
+ ENV ARJDBC_BRANCH $TARGET_ARJDBC_BRANCH
17
+
18
+ RUN bundle install --jobs `expr $(cat /proc/cpuinfo | grep -c "cpu cores") - 1` --retry 3
19
+
20
+ CMD ["sh"]
data/Gemfile ADDED
@@ -0,0 +1,77 @@
1
+ require 'openssl'
2
+ source 'https://rubygems.org'
3
+ gemspec
4
+
5
+ gem 'rb-readline', platform: :mri
6
+ gem 'sqlite3', platform: :mri
7
+ gem 'minitest', '< 5.3.4'
8
+ gem 'bcrypt'
9
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
10
+
11
+ if RbConfig::CONFIG["host_os"] =~ /darwin/
12
+ gem 'terminal-notifier-guard'
13
+ end
14
+
15
+
16
+ arjdbc_repo = 'https://github.com/jruby/activerecord-jdbc-adapter.git'
17
+
18
+ if ENV['ARJDBC_SOURCE']
19
+ gem 'activerecord-jdbc-adapter', path: ENV['ARJDBC_SOURCE']
20
+ elsif ENV['ARJDBC_BRANCH']
21
+ gem 'activerecord-jdbc-adapter', git: arjdbc_repo, branch: ENV['ARJDBC_BRANCH']
22
+ elsif ENV['ARJDBC_TAG']
23
+ gem 'activerecord-jdbc-adapter', git: arjdbc_repo, tag: ENV['ARJDBC_TAG']
24
+ elsif ENV['ARJDBC_COMMIT']
25
+ gem 'activerecord-jdbc-adapter', git: arjdbc_repo, ref: ENV['ARJDBC_COMMIT']
26
+ end
27
+
28
+ if ENV['RAILS_SOURCE']
29
+ gemspec path: ENV['RAILS_SOURCE']
30
+ else
31
+ # Need to get rails source because the gem doesn't include tests
32
+ version = ENV['RAILS_VERSION'] || begin
33
+ require 'net/http'
34
+ require 'yaml'
35
+ spec = eval(File.read('activerecord-jdbcsqlserver-adapter.gemspec'))
36
+ ver = spec.dependencies.detect{ |d|d.name == 'activerecord' }.requirement.requirements.first.last.version
37
+ major, minor, tiny, pre = ver.split('.')
38
+ if !pre
39
+ uri = URI.parse "https://rubygems.org/api/v1/versions/activerecord.yaml"
40
+ http = Net::HTTP.new(uri.host, uri.port)
41
+ http.use_ssl = true
42
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
43
+ YAML.load(http.request(Net::HTTP::Get.new(uri.request_uri)).body).select do |data|
44
+ a, b, c = data['number'].split('.')
45
+ !data['prerelease'] && major == a && (minor.nil? || minor == b)
46
+ end.first['number']
47
+ else
48
+ ver
49
+ end
50
+ end
51
+ gem 'rails', git: "https://github.com/rails/rails.git", tag: "v#{version}"
52
+ end
53
+
54
+ if ENV['AREL']
55
+ gem 'arel', path: ENV['AREL']
56
+ end
57
+
58
+ group :tinytds do
59
+ if ENV['TINYTDS_SOURCE']
60
+ gem 'tiny_tds', path: ENV['TINYTDS_SOURCE'], platform: :mri
61
+ elsif ENV['TINYTDS_VERSION']
62
+ gem 'tiny_tds', ENV['TINYTDS_VERSION'], platform: :mri
63
+ else
64
+ gem 'tiny_tds', platform: :mri
65
+ end
66
+ end
67
+
68
+ group :development do
69
+ gem 'byebug', platform: :mri
70
+ gem 'mocha'
71
+ gem 'minitest-spec-rails'
72
+ end
73
+
74
+ group :guard do
75
+ gem 'guard'
76
+ gem 'guard-minitest'
77
+ end
@@ -0,0 +1,29 @@
1
+
2
+ require_relative 'test/support/paths_sqlserver'
3
+
4
+ clearing :on
5
+ notification :terminal_notifier if defined?(TerminalNotifier)
6
+ ignore %r{debug\.log}
7
+
8
+ ar_lib = File.join ARTest::SQLServer.root_activerecord, 'lib'
9
+ ar_test = File.join ARTest::SQLServer.root_activerecord, 'test'
10
+
11
+ guard :minitest, {
12
+ all_on_start: false,
13
+ autorun: false,
14
+ include: ['lib', 'test', ar_lib, ar_test],
15
+ test_folders: ['test'],
16
+ test_file_patterns: ["*_test.rb", "*_test_sqlserver.rb"]
17
+ } do
18
+ # Our project watchers.
19
+ if ENV['TEST_FILES']
20
+ ENV['TEST_FILES'].split(',').map(&:strip).each do |file|
21
+ watch(%r{.*}) { file }
22
+ end
23
+ else
24
+ watch(%r{^test/cases/\w+_test_sqlserver\.rb$})
25
+ watch(%r{^test/cases/coerced_tests\.rb$}) { "test/cases/coerced_tests.rb" }
26
+ watch(%r{^lib/active_record/connection_adapters/sqlserver/([^/]+)\.rb$}) { |m| "test/cases/#{m[1]}_test_sqlserver.rb" }
27
+ watch(%r{^test/cases/helper_sqlserver\.rb$}) { 'test' }
28
+ end
29
+ end
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008-2015
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,5 @@
1
+
2
+ ## Rails v5.1
3
+
4
+ * BIGINT PK support. https://github.com/rails/rails/pull/26266
5
+
@@ -0,0 +1,93 @@
1
+ # ActiveRecord SQL Server Adapter. For SQL Server 2012 And Higher.
2
+
3
+ [![Gem Version](http://img.shields.io/gem/v/activerecord-jdbcsqlserver-adapter.svg)](https://rubygems.org/gems/activerecord-jdbcsqlserver-adapter) - Gem Version
4
+
5
+
6
+ The JDBC SQL Server adapter for ActiveRecord v5.0 using SQL Server 2012 or higher.
7
+
8
+ We currently support JRuby 9.2+. Older versions may work but they are not tested and there is a known date issue with JRuby 9.1.
9
+
10
+ For older versions see [activerecord-jdbcmssql-adapter](https://rubygems.org/gems/activerecord-jdbcmssql-adapter)
11
+
12
+
13
+ #### Native Data Type Support
14
+
15
+ The Rails v5 adapter supports ActiveRecord's `datetime_with_precision` setting. This means that passing `:precision` to a datetime column is supported. Using a pecision with the `:datetime` type will signal the adapter to use the `datetime2` type under the hood.
16
+
17
+ #### Schemas & Users
18
+
19
+ Depending on your user and schema setup, it may be needed to use a table name prefix of `dbo.`. So something like this in your initializer file for ActiveRecord or the adapter.
20
+
21
+ ```ruby
22
+ ActiveRecord::Base.table_name_prefix = 'dbo.'
23
+ ```
24
+
25
+ #### Explain Support (SHOWPLAN)
26
+
27
+ ActiveRecord's explain features are supported. In SQL Server, this is called the showplan. By default we use the `SHOWPLAN_ALL` option and format it using a simple table printer. So the following ruby would log the plan table below it.
28
+
29
+ ```ruby
30
+ Car.where(id: 1).explain
31
+ ```
32
+
33
+ ```
34
+ EXPLAIN for: SELECT [cars].* FROM [cars] WHERE [cars].[id] = 1
35
+ +----------------------------------------------------+--------+--------+--------+----------------------+----------------------+----------------------------------------------------+----------------------------------------------------+--------------+---------------------+----------------------+------------+---------------------+----------------------------------------------------+----------+----------+----------+--------------------+
36
+ | StmtText | StmtId | NodeId | Parent | PhysicalOp | LogicalOp | Argument | DefinedValues | EstimateRows | EstimateIO | EstimateCPU | AvgRowSize | TotalSubtreeCost | OutputList | Warnings | Type | Parallel | EstimateExecutions |
37
+ +----------------------------------------------------+--------+--------+--------+----------------------+----------------------+----------------------------------------------------+----------------------------------------------------+--------------+---------------------+----------------------+------------+---------------------+----------------------------------------------------+----------+----------+----------+--------------------+
38
+ | SELECT [cars].* FROM [cars] WHERE [cars].[id] = 1 | 1 | 1 | 0 | NULL | NULL | 2 | NULL | 1.0 | NULL | NULL | NULL | 0.00328309996984899 | NULL | NULL | SELECT | false | NULL |
39
+ | |--Clustered Index Seek(OBJECT:([activerecord... | 1 | 2 | 1 | Clustered Index Seek | Clustered Index Seek | OBJECT:([activerecord_unittest].[dbo].[cars].[P... | [activerecord_unittest].[dbo].[cars].[id], [act... | 1.0 | 0.00312500004656613 | 0.000158099996042438 | 278 | 0.00328309996984899 | [activerecord_unittest].[dbo].[cars].[id], [act... | NULL | PLAN_ROW | false | 1.0 |
40
+ +----------------------------------------------------+--------+--------+--------+----------------------+----------------------+----------------------------------------------------+----------------------------------------------------+--------------+---------------------+----------------------+------------+---------------------+----------------------------------------------------+----------+----------+----------+--------------------+
41
+ ```
42
+
43
+ ## Installation
44
+
45
+ ```ruby
46
+ gem 'activerecord-jdbcsqlserver-adapter'
47
+ ```
48
+
49
+
50
+ ## Contributing
51
+
52
+ If you would like to contribute a feature or bugfix, thanks! To make sure your fix/feature has a high chance of being added, please read the following guidelines. First, ask on the Gitter, or post a ticket on github issues. Second, make sure there are tests! We will not accept any patch that is not tested. Please read the `RUNNING_UNIT_TESTS` file for the details of how to run the unit tests.
53
+
54
+ This is a fork of the activerecord-sqlserver-adapter. If you find a bug in the base code, please submit patches to: http://github.com/rails-sqlserver/activerecord-sqlserver-adapter
55
+
56
+ If the bug/feature is JRuby or specific to this gem, please submit patches to: http://github.com/jruby/activerecord-jdbcsqlserver-adapter
57
+
58
+
59
+ ## Credits & Contributions
60
+
61
+ Many many people have contributed. If you do not see your name here and it should be let us know. Also, many thanks go out to those that have pledged financial contributions.
62
+
63
+
64
+ ## Contributers
65
+
66
+ Up-to-date list of contributors: http://github.com/rails-sqlserver/activerecord-sqlserver-adapter/contributors
67
+
68
+ Original Gem:
69
+ * metaskills (Ken Collins)
70
+ * Annaswims (Annaswims)
71
+ * wbond (Will Bond)
72
+ * Thirdshift (Garrett Hart)
73
+ * h-lame (Murray Steele)
74
+ * vegantech
75
+ * cjheath (Clifford Heath)
76
+ * fryguy (Jason Frey)
77
+ * jrafanie (Joe Rafaniello)
78
+ * nerdrew (Andrew Ryan)
79
+ * snowblink (Jonathan Lim)
80
+ * koppen (Jakob Skjerning)
81
+ * ebryn (Erik Bryn)
82
+ * adzap (Adam Meehan)
83
+ * neomindryan (Ryan Findley)
84
+ * jeremydurham (Jeremy Durham)
85
+
86
+ JDBC version of the gem:
87
+ * rdubya (Rob Widmer)
88
+
89
+
90
+ ## License
91
+
92
+ Copyright © 2008-2019. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
93
+