activerecord-sqlserver-adapter-odbc-extended 8.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/issue_template.md +22 -0
- data/.github/workflows/ci.yml +32 -0
- data/.gitignore +9 -0
- data/.rubocop.yml +69 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/Dockerfile.ci +14 -0
- data/Gemfile +26 -0
- data/LICENSE.txt +21 -0
- data/README.md +104 -0
- data/RUNNING_UNIT_TESTS.md +38 -0
- data/Rakefile +45 -0
- data/VERSION +1 -0
- data/activerecord-sqlserver-adapter-odbc-extended.gemspec +34 -0
- data/compose.ci.yaml +15 -0
- data/lib/active_record/connection_adapters/extended_sqlserver_adapter.rb +204 -0
- data/lib/active_record/connection_adapters/sqlserver/core_ext/odbc.rb +41 -0
- data/lib/active_record/connection_adapters/sqlserver/odbc_database_statements.rb +234 -0
- data/lib/active_record/connection_adapters/sqlserver/type/binary_ext.rb +25 -0
- data/lib/activerecord-sqlserver-adapter-odbc-extended.rb +12 -0
- data/test/appveyor/dbsetup.ps1 +27 -0
- data/test/appveyor/dbsetup.sql +11 -0
- data/test/cases/active_schema_test_sqlserver.rb +127 -0
- data/test/cases/adapter_test_sqlserver.rb +648 -0
- data/test/cases/change_column_collation_test_sqlserver.rb +33 -0
- data/test/cases/change_column_null_test_sqlserver.rb +44 -0
- data/test/cases/coerced_tests.rb +2796 -0
- data/test/cases/column_test_sqlserver.rb +848 -0
- data/test/cases/connection_test_sqlserver.rb +138 -0
- data/test/cases/dbconsole.rb +19 -0
- data/test/cases/disconnected_test_sqlserver.rb +42 -0
- data/test/cases/eager_load_too_many_ids_test_sqlserver.rb +18 -0
- data/test/cases/enum_test_sqlserver.rb +49 -0
- data/test/cases/execute_procedure_test_sqlserver.rb +57 -0
- data/test/cases/fetch_test_sqlserver.rb +88 -0
- data/test/cases/fully_qualified_identifier_test_sqlserver.rb +72 -0
- data/test/cases/helper_sqlserver.rb +61 -0
- data/test/cases/migration_test_sqlserver.rb +144 -0
- data/test/cases/order_test_sqlserver.rb +153 -0
- data/test/cases/pessimistic_locking_test_sqlserver.rb +102 -0
- data/test/cases/primary_keys_test_sqlserver.rb +103 -0
- data/test/cases/rake_test_sqlserver.rb +198 -0
- data/test/cases/schema_dumper_test_sqlserver.rb +296 -0
- data/test/cases/schema_test_sqlserver.rb +111 -0
- data/test/cases/trigger_test_sqlserver.rb +51 -0
- data/test/cases/utils_test_sqlserver.rb +129 -0
- data/test/cases/uuid_test_sqlserver.rb +54 -0
- data/test/cases/view_test_sqlserver.rb +58 -0
- data/test/config.yml +38 -0
- data/test/debug.rb +16 -0
- data/test/fixtures/1px.gif +0 -0
- data/test/migrations/create_clients_and_change_column_collation.rb +19 -0
- data/test/migrations/create_clients_and_change_column_null.rb +25 -0
- data/test/migrations/transaction_table/1_table_will_never_be_created.rb +11 -0
- data/test/models/sqlserver/alien.rb +5 -0
- data/test/models/sqlserver/booking.rb +5 -0
- data/test/models/sqlserver/composite_pk.rb +9 -0
- data/test/models/sqlserver/customers_view.rb +5 -0
- data/test/models/sqlserver/datatype.rb +5 -0
- data/test/models/sqlserver/datatype_migration.rb +10 -0
- data/test/models/sqlserver/dollar_table_name.rb +5 -0
- data/test/models/sqlserver/edge_schema.rb +13 -0
- data/test/models/sqlserver/fk_has_fk.rb +5 -0
- data/test/models/sqlserver/fk_has_pk.rb +5 -0
- data/test/models/sqlserver/natural_pk_data.rb +6 -0
- data/test/models/sqlserver/natural_pk_int_data.rb +5 -0
- data/test/models/sqlserver/no_pk_data.rb +5 -0
- data/test/models/sqlserver/object_default.rb +5 -0
- data/test/models/sqlserver/quoted_table.rb +9 -0
- data/test/models/sqlserver/quoted_view_1.rb +5 -0
- data/test/models/sqlserver/quoted_view_2.rb +5 -0
- data/test/models/sqlserver/sst_memory.rb +5 -0
- data/test/models/sqlserver/sst_string_collation.rb +3 -0
- data/test/models/sqlserver/string_default.rb +5 -0
- data/test/models/sqlserver/string_defaults_big_view.rb +5 -0
- data/test/models/sqlserver/string_defaults_view.rb +5 -0
- data/test/models/sqlserver/table_with_spaces.rb +5 -0
- data/test/models/sqlserver/tinyint_pk.rb +5 -0
- data/test/models/sqlserver/trigger.rb +17 -0
- data/test/models/sqlserver/trigger_history.rb +5 -0
- data/test/models/sqlserver/upper.rb +5 -0
- data/test/models/sqlserver/uppered.rb +5 -0
- data/test/models/sqlserver/uuid.rb +5 -0
- data/test/schema/datatypes/2012.sql +56 -0
- data/test/schema/enable-in-memory-oltp.sql +81 -0
- data/test/schema/sqlserver_specific_schema.rb +363 -0
- data/test/support/coerceable_test_sqlserver.rb +55 -0
- data/test/support/connection_reflection.rb +32 -0
- data/test/support/core_ext/query_cache.rb +38 -0
- data/test/support/load_schema_sqlserver.rb +29 -0
- data/test/support/marshal_compatibility_fixtures/SQLServer/rails_6_1_topic.dump +0 -0
- data/test/support/marshal_compatibility_fixtures/SQLServer/rails_6_1_topic_associations.dump +0 -0
- data/test/support/marshal_compatibility_fixtures/SQLServer/rails_7_1_topic.dump +0 -0
- data/test/support/marshal_compatibility_fixtures/SQLServer/rails_7_1_topic_associations.dump +0 -0
- data/test/support/minitest_sqlserver.rb +3 -0
- data/test/support/paths_sqlserver.rb +50 -0
- data/test/support/query_assertions.rb +49 -0
- data/test/support/rake_helpers.rb +46 -0
- data/test/support/table_definition_sqlserver.rb +24 -0
- data/test/support/test_in_memory_oltp.rb +17 -0
- metadata +240 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 6c3a5e087869913ee2efc2484ec7c5081d5cc74a070cd6addcd6651290e5f471
|
|
4
|
+
data.tar.gz: 90fae2c097ae94bae9e14bd99e8d82aaa48eaccb13e9a95813cd55b92a692a28
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 69b6a87a15ae3f931c7c7b59c8580c244a7d60b8cd9f09a0df30884f7611a3286ec205b72e94c4b8cc18ec8bfef962b3b74e5357d6fc3bcbd3809bb6e4e90c33
|
|
7
|
+
data.tar.gz: 05fe7efeacf199e38c906c0950a0304bf8fc263ff2daa49491210e9a49c8950389b5a184536667df26a8603989681dc0feb94d126cc9a9b494d76f03feca93aa
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
## Issue
|
|
2
|
+
<!-- Give a brief summary of the issue. -->
|
|
3
|
+
|
|
4
|
+
## Expected behavior
|
|
5
|
+
<!-- Tell us what should happen -->
|
|
6
|
+
|
|
7
|
+
## Actual behavior
|
|
8
|
+
<!-- Tell us what happens instead -->
|
|
9
|
+
|
|
10
|
+
## How to reproduce
|
|
11
|
+
<!-- See https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/How-to-report-a-bug -->
|
|
12
|
+
|
|
13
|
+
## Details
|
|
14
|
+
|
|
15
|
+
- **Rails version**: `x.x.x`
|
|
16
|
+
- **SQL Server adapter version**: `x.x.x`
|
|
17
|
+
- **Ruby ODBC version**: `x.x.x`
|
|
18
|
+
- **ODBC Driver details**:
|
|
19
|
+
```
|
|
20
|
+
run `tsql -C` and paste here the output.
|
|
21
|
+
```
|
|
22
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
name: Run test suite
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
|
|
10
|
+
env:
|
|
11
|
+
COMPOSE_FILE: compose.ci.yaml
|
|
12
|
+
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
ruby:
|
|
17
|
+
- 3.4
|
|
18
|
+
- 3.2
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- name: Print trigger info
|
|
22
|
+
run: echo "CI workflow triggered successfully!"
|
|
23
|
+
|
|
24
|
+
- name: Checkout code
|
|
25
|
+
uses: actions/checkout@v2
|
|
26
|
+
|
|
27
|
+
- name: Install Dependencies
|
|
28
|
+
run: docker compose build --no-cache --build-arg TARGET_VERSION=${{ matrix.ruby }}
|
|
29
|
+
|
|
30
|
+
- name: Run Lint
|
|
31
|
+
run: docker compose run ci bundle exec rubocop --parallel --format progress
|
|
32
|
+
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
TargetRubyVersion: 3.2.4
|
|
3
|
+
Exclude:
|
|
4
|
+
- 'test/**/*'
|
|
5
|
+
|
|
6
|
+
Layout/LineLength:
|
|
7
|
+
Max: 120
|
|
8
|
+
|
|
9
|
+
Naming/AccessorMethodName:
|
|
10
|
+
Enabled: false
|
|
11
|
+
|
|
12
|
+
Metrics/CyclomaticComplexity:
|
|
13
|
+
Max: 15
|
|
14
|
+
|
|
15
|
+
Metrics/AbcSize:
|
|
16
|
+
Max: 25
|
|
17
|
+
Exclude:
|
|
18
|
+
- lib/active_record/connection_adapters/extended_sqlserver_adapter.rb
|
|
19
|
+
- lib/active_record/connection_adapters/sqlserver/odbc_database_statements.rb
|
|
20
|
+
|
|
21
|
+
Naming/FileName:
|
|
22
|
+
Exclude:
|
|
23
|
+
- lib/activerecord-sqlserver-adapter-odbc-extended.rb
|
|
24
|
+
|
|
25
|
+
Naming/MethodName:
|
|
26
|
+
IgnoredPatterns:
|
|
27
|
+
- visit_.*
|
|
28
|
+
- primary_Key_From_Table
|
|
29
|
+
- table_From_Statement
|
|
30
|
+
- distinct_One_As_One_Is_So_Not_Fetch
|
|
31
|
+
- make_Fetch_Possible_And_Deterministic
|
|
32
|
+
|
|
33
|
+
Naming/MethodParameterName:
|
|
34
|
+
Enabled: false
|
|
35
|
+
|
|
36
|
+
Naming/PredicatePrefix:
|
|
37
|
+
Enabled: false
|
|
38
|
+
|
|
39
|
+
Style/StringLiterals:
|
|
40
|
+
EnforcedStyle: double_quotes
|
|
41
|
+
|
|
42
|
+
Style/StringLiteralsInInterpolation:
|
|
43
|
+
EnforcedStyle: double_quotes
|
|
44
|
+
|
|
45
|
+
Style/ExplicitBlockArgument:
|
|
46
|
+
Exclude:
|
|
47
|
+
- lib/active_record/connection_adapters/sqlserver/odbc_database_statements.rb
|
|
48
|
+
|
|
49
|
+
Metrics/ClassLength:
|
|
50
|
+
Exclude:
|
|
51
|
+
- lib/active_record/connection_adapters/extended_sqlserver_adapter.rb
|
|
52
|
+
|
|
53
|
+
Metrics/MethodLength:
|
|
54
|
+
Exclude:
|
|
55
|
+
- lib/active_record/connection_adapters/extended_sqlserver_adapter.rb
|
|
56
|
+
- lib/active_record/connection_adapters/sqlserver/odbc_database_statements.rb
|
|
57
|
+
|
|
58
|
+
Metrics/ModuleLength:
|
|
59
|
+
Exclude:
|
|
60
|
+
- lib/active_record/connection_adapters/sqlserver/odbc_database_statements.rb
|
|
61
|
+
|
|
62
|
+
Metrics/PerceivedComplexity:
|
|
63
|
+
Exclude:
|
|
64
|
+
- lib/active_record/connection_adapters/sqlserver/odbc_database_statements.rb
|
|
65
|
+
- lib/active_record/connection_adapters/extended_sqlserver_adapter.rb
|
|
66
|
+
|
|
67
|
+
Style/MultilineBlockChain:
|
|
68
|
+
Exclude:
|
|
69
|
+
- lib/active_record/connection_adapters/extended_sqlserver_adapter.rb
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
+
identity and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
|
26
|
+
community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
|
31
|
+
any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
|
35
|
+
without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official email address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
[INSERT CONTACT METHOD].
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series of
|
|
86
|
+
actions.
|
|
87
|
+
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
|
93
|
+
ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
|
113
|
+
community.
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
+
version 2.1, available at
|
|
119
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
120
|
+
|
|
121
|
+
Community Impact Guidelines were inspired by
|
|
122
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
123
|
+
|
|
124
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
125
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
|
126
|
+
[https://www.contributor-covenant.org/translations][translations].
|
|
127
|
+
|
|
128
|
+
[homepage]: https://www.contributor-covenant.org
|
|
129
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
130
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
131
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
132
|
+
[translations]: https://www.contributor-covenant.org/translations
|
data/Dockerfile.ci
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
ARG TARGET_VERSION=3.2
|
|
2
|
+
|
|
3
|
+
FROM mcr.microsoft.com/devcontainers/ruby:${TARGET_VERSION}
|
|
4
|
+
|
|
5
|
+
ENV WORKDIR /activerecord-sqlserver-adapter-odbc-extended
|
|
6
|
+
|
|
7
|
+
RUN mkdir -p $WORKDIR
|
|
8
|
+
WORKDIR $WORKDIR
|
|
9
|
+
|
|
10
|
+
COPY . $WORKDIR
|
|
11
|
+
|
|
12
|
+
RUN bundle install --jobs `expr $(nproc) - 1` --retry 3
|
|
13
|
+
|
|
14
|
+
CMD ["sh"]
|
data/Gemfile
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
4
|
+
|
|
5
|
+
gemspec
|
|
6
|
+
|
|
7
|
+
is_windows = %i[mingw x64_mingw mswin x64_mingw_ucrt].include?(RUBY_PLATFORM.gsub("-", "_").to_sym)
|
|
8
|
+
|
|
9
|
+
gem "minitest", "~> 5.16"
|
|
10
|
+
gem "rake", "~> 13.0"
|
|
11
|
+
|
|
12
|
+
group :development do
|
|
13
|
+
gem "minitest-spec-rails"
|
|
14
|
+
gem "mocha"
|
|
15
|
+
gem "pry-byebug", platform: %i[mri mingw x64_mingw]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
group :odbc do
|
|
19
|
+
install_if -> { is_windows } do
|
|
20
|
+
gem "ruby-odbc-supported", "~> 1.0"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
group :rubocop do
|
|
25
|
+
gem "rubocop", "~> 1.21", require: false
|
|
26
|
+
end
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 TODO: Write your name
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# ActiveRecord SQL Server Adapter ODBC Extended
|
|
2
|
+
|
|
3
|
+
* [](https://github.com/cloudvolumes/activerecord-sqlserver-adapter-odbc-extended/actions/workflows/ci.yml) - CI
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## About The Adapter
|
|
7
|
+
|
|
8
|
+
This gem extends the ActiveRecord SQL Server adapter by adding enhanced functionality and customization, including ODBC support. It is compatible with both FreeTDS and ODBC connections.
|
|
9
|
+
|
|
10
|
+
We follow a versioning policy aligned with the ActiveRecord SQLServer Adapter. This means that version 8.x of this extended adapter corresponds to and supports the latest 8.x version of the activerecord-sqlserver-adapter gem.
|
|
11
|
+
|
|
12
|
+
We support the versions of the adapter that are in the Rails [Bug Fixes](https://rubyonrails.org/maintenance)
|
|
13
|
+
maintenance group.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
| Adapter Version | Rails Version | Support | Branch |
|
|
17
|
+
|-----------------|---------------|----------------|----------------------------------------------------------------------------------------------------|
|
|
18
|
+
| `8.0.x` | `8.0.x` | Active | [8-0-stable](https://github.com/cloudvolumes/activerecord-sqlserver-adapter-odbc-extended/tree/8-0-stable) |
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Using the TinyTDS Driver
|
|
23
|
+
|
|
24
|
+
If you are using the TinyTDS driver, please refer to the original gem’s README for setup and version details: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/8-0-stable
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Database configuration
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
Example:
|
|
31
|
+
|
|
32
|
+
```yaml
|
|
33
|
+
development:
|
|
34
|
+
adapter: sqlserver
|
|
35
|
+
mode: 'dblib'
|
|
36
|
+
host: 'localhost'
|
|
37
|
+
port: 1433
|
|
38
|
+
database: my_app_development
|
|
39
|
+
username: 'frank_castle'
|
|
40
|
+
password: 'secret'
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## Using the ODBC Driver
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
- Extends ActiveRecord::ConnectionAdapters::SQLServerAdapter
|
|
49
|
+
- Adds custom connection logic and methods
|
|
50
|
+
- Supports ODBC and DBLIB modes
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Installation
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
1. Add to Gemfile
|
|
57
|
+
```ruby
|
|
58
|
+
gem 'activerecord-sqlserver-adapter-odbc-extended', '~> 8.0.9'
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
2. Bundle install and Database configuration
|
|
62
|
+
```
|
|
63
|
+
bundle install
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Example:
|
|
67
|
+
|
|
68
|
+
```yaml
|
|
69
|
+
development:
|
|
70
|
+
adapter: sqlserver
|
|
71
|
+
mode: 'odbc'
|
|
72
|
+
host: 'localhost'
|
|
73
|
+
port: 1433
|
|
74
|
+
database: my_app_development
|
|
75
|
+
username: 'frank_castle'
|
|
76
|
+
password: 'secret'
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
## Contributing
|
|
81
|
+
|
|
82
|
+
Please contribute to the project by submitting bug fixes and features. To make sure your fix/feature has
|
|
83
|
+
a high chance of being added, please include tests in your pull request. To run the tests you will need to
|
|
84
|
+
setup your development environment.
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
## Setting Up Your Development Environment
|
|
88
|
+
|
|
89
|
+
To run the test suite you can use any of the following methods below. See [RUNNING_UNIT_TESTS](RUNNING_UNIT_TESTS.md) for
|
|
90
|
+
more detailed information on running unit tests.
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
### Local Development
|
|
94
|
+
|
|
95
|
+
See the [RUNNING_UNIT_TESTS](RUNNING_UNIT_TESTS.md) file for the details of how to run the unit tests locally.
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## Credits & Contributions
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
ActiveRecord SQL Server Adapter with ODBC Support is released under the [MIT License](https://opensource.org/licenses/MIT).
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# How To Run The Tests Locally
|
|
2
|
+
|
|
3
|
+
To run the tests for the SQL Server adapter in your local environment, refer to the documentation provided in the original gem repository: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Bundling
|
|
7
|
+
|
|
8
|
+
Now with that out of the way you can run "bundle install" to hook everything up. Our tests use bundler to setup the load paths correctly. The default mode is DBLIB using TinyTDS. It is important to use bundle exec so we can wire up the ActiveRecord test libs correctly.
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
$ bundle exec rake test
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Testing Options
|
|
16
|
+
|
|
17
|
+
The Gemfile contains groups for `:tinytds` and `:odbc`. By default it will install both gems which allows you to run the full test suite in either connection mode. If for some reason any one of these is problematic or of no concern, you could always opt out of bundling either gem with something like this.
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
$ bundle install --without odbc
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
You can run different connection modes using the following rake commands. Again, the DBLIB connection mode using TinyTDS is the default test task.
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
$ bundle exec rake test:dblib
|
|
27
|
+
$ bundle exec rake test:odbc
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
By default, Bundler will download the Rails git repo and use the git tag that matches the dependency version in our gemspec. If you want to test another version of Rails, you can either temporarily change the :tag for Rails in the Gemfile. Likewise, you can clone the Rails repo your self to another directory and use the `RAILS_SOURCE` environment variable.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## Troubleshooting
|
|
35
|
+
|
|
36
|
+
* Make sure your firewall is off or allows SQL Server traffic both ways, typically on port 1433.
|
|
37
|
+
* Ensure that you are running on a local admin login to create the Rails user.
|
|
38
|
+
* Possibly change the SQL Server TCP/IP properties in "SQL Server Configuration Manager -> SQL Server Network Configuration -> Protocols for MSSQLSERVER", and ensure that TCP/IP is enabled and the appropriate entries on the "IP Addresses" tab are enabled.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bundler/gem_tasks"
|
|
4
|
+
require "rake/testtask"
|
|
5
|
+
require_relative "test/support/paths_sqlserver"
|
|
6
|
+
require_relative "test/support/rake_helpers"
|
|
7
|
+
|
|
8
|
+
# Default task runs dblib tests
|
|
9
|
+
task default: ["test:dblib"]
|
|
10
|
+
|
|
11
|
+
namespace :test do
|
|
12
|
+
%w[dblib odbc].each do |mode|
|
|
13
|
+
Rake::TestTask.new(mode) do |t|
|
|
14
|
+
t.libs = ARTest::SQLServer.test_load_paths
|
|
15
|
+
t.test_files = test_files
|
|
16
|
+
t.warning = !ENV["WARNING"].nil?
|
|
17
|
+
t.verbose = false
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Each mode’s env setup
|
|
21
|
+
task "#{mode}:env" do
|
|
22
|
+
ENV["ARCONN"] = mode
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Run tests after setting env
|
|
26
|
+
task mode => "#{mode}:env" do
|
|
27
|
+
Rake::Task[mode].invoke
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
namespace :profile do
|
|
33
|
+
%w[dblib odbc].each do |mode|
|
|
34
|
+
namespace mode.to_sym do
|
|
35
|
+
Dir.glob("test/profile/*_profile_case.rb").sort.each do |test_file|
|
|
36
|
+
profile_case = File.basename(test_file).sub("_profile_case.rb", "")
|
|
37
|
+
Rake::TestTask.new(profile_case) do |t|
|
|
38
|
+
t.libs = ARTest::SQLServer.test_load_paths
|
|
39
|
+
t.test_files = [test_file]
|
|
40
|
+
t.verbose = true
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
8.0.10
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
version = File.read(File.expand_path("VERSION", __dir__)).strip
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "activerecord-sqlserver-adapter-odbc-extended"
|
|
7
|
+
spec.version = version
|
|
8
|
+
spec.authors = ["Jyothish"]
|
|
9
|
+
spec.email = ["jyothu.kr@gmail.com"]
|
|
10
|
+
|
|
11
|
+
spec.platform = Gem::Platform::RUBY
|
|
12
|
+
spec.homepage = "http://github.com/cloudvolumes/activerecord-sqlserver-adapter-odbc-extended"
|
|
13
|
+
spec.summary = "ActiveRecord SQL Server Adapter with ODBC support."
|
|
14
|
+
spec.description = "ActiveRecord SQL Server Adapter. SQL Server 2012 and upward."
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
spec.required_ruby_version = ">= 3.2.0"
|
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
19
|
+
spec.metadata["source_code_uri"] = "https://github.com/cloudvolumes/activerecord-sqlserver-adapter-odbc-extended/tree/v#{version}"
|
|
20
|
+
spec.metadata["changelog_uri"] = "https://github.com/cloudvolumes/activerecord-sqlserver-adapter-odbc-extended/blob/v#{version}/CHANGELOG.md"
|
|
21
|
+
|
|
22
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
23
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
24
|
+
spec.require_paths = ["lib"]
|
|
25
|
+
|
|
26
|
+
spec.add_dependency "activerecord-sqlserver-adapter", "~> 8.0.0"
|
|
27
|
+
|
|
28
|
+
# Define Windows check (reuse your logic)
|
|
29
|
+
is_windows = %i[mingw x64_mingw mswin x64_mingw_ucrt].include?(
|
|
30
|
+
RUBY_PLATFORM.gsub("-", "_").to_sym
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
spec.add_dependency "ruby-odbc-supported" if is_windows
|
|
34
|
+
end
|
data/compose.ci.yaml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
version: "2.2"
|
|
2
|
+
|
|
3
|
+
services:
|
|
4
|
+
sqlserver:
|
|
5
|
+
image: ghcr.io/rails-sqlserver/mssql-server-linux-rails
|
|
6
|
+
|
|
7
|
+
ci:
|
|
8
|
+
environment:
|
|
9
|
+
- ACTIVERECORD_UNITTEST_HOST=sqlserver
|
|
10
|
+
build:
|
|
11
|
+
context: .
|
|
12
|
+
dockerfile: Dockerfile.ci
|
|
13
|
+
command: wait-for sqlserver:1433 -- bundle exec rake test:odbc
|
|
14
|
+
depends_on:
|
|
15
|
+
- "sqlserver"
|