From 1f4c7b174cb24f0a9d00be87adb269562d6f67cc Mon Sep 17 00:00:00 2001 From: Andy Pfister Date: Fri, 1 Aug 2025 13:39:30 +0200 Subject: [PATCH 1/6] Bump version to v4 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 15a27998..fcdb2e10 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.3.0 +4.0.0 From d88bcfdd7488d23e76574441fca6daa65bc5edaa Mon Sep 17 00:00:00 2001 From: Andy Pfister Date: Mon, 8 Sep 2025 15:00:30 +0200 Subject: [PATCH 2/6] Drop support for Ruby < v3.2 --- .devcontainer/Dockerfile | 4 +- .github/workflows/ci.yml | 142 +----------------- CHANGELOG.md | 2 + README.md | 2 +- Rakefile | 1 - ext/tiny_tds/extconf.rb | 16 +- .../1.00.27/0001-mingw_missing_inet_pton.diff | 34 ----- .../0002-Don-t-use-MSYS2-file-libws2_32.diff | 28 ---- tasks/native_gem.rake | 2 +- tiny_tds.gemspec | 2 +- 10 files changed, 14 insertions(+), 219 deletions(-) delete mode 100644 patches/freetds/1.00.27/0001-mingw_missing_inet_pton.diff delete mode 100644 patches/freetds/1.00.27/0002-Don-t-use-MSYS2-file-libws2_32.diff diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 6fab8c1c..e394897b 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/devcontainers/ruby:2.7 +FROM mcr.microsoft.com/devcontainers/ruby:3.2 # Install the SQL Server command-line tools and the Artistic Style code formatter RUN curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc \ @@ -8,7 +8,7 @@ RUN curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/t ENV PATH=$PATH:/opt/mssql-tools18/bin # Install FreeTDS -ENV FREETDS_VERSION=1.5.1 +ENV FREETDS_VERSION=1.5.4 COPY test/bin/install-freetds.sh /tmp/ RUN /tmp/install-freetds.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d48fb47..a619bdad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,6 @@ jobs: fail-fast: false matrix: platform: - - "x64-mingw32" - "x64-mingw-ucrt" - "x86_64-linux-gnu" - "x86_64-linux-musl" @@ -26,7 +25,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: "2.7" + ruby-version: "3.2" - name: "Install dependencies" run: bundle install @@ -53,121 +52,6 @@ jobs: name: gem-${{ matrix.platform }} path: pkg/*.gem - install-windows-mingw: - needs: - - cross-compile - strategy: - fail-fast: false - matrix: - ruby-version: - - "2.7" - - "3.0" - - name: install-windows-mingw - runs-on: windows-latest - steps: - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby-version }} - bundler-cache: true - - - name: Download precompiled gem - uses: actions/download-artifact@v4 - with: - name: gem-x64-mingw32 - - - name: Install native gem - shell: pwsh - run: gem install "tiny_tds-*.gem" - - - name: Test if TinyTDS loads - shell: pwsh - run: | - ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path" - exit $LASTEXITCODE - - - name: Test if tsql wrapper works - shell: pwsh - run: | - tsql-ttds -C - exit $LASTEXITCODE - - - name: Test if defncopy wrapper works - shell: pwsh - run: | - defncopy-ttds -v - exit $LASTEXITCODE - - test-windows-mingw: - needs: - - cross-compile - strategy: - fail-fast: false - matrix: - force-encryption: - - false - - true - mssql-version: - - 2017 - - 2019 - - 2022 - ruby-version: - - "2.7" - - "3.0" - - name: test-windows-mingw - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby-version }} - bundler-cache: true - - - name: Download precompiled gem - uses: actions/download-artifact@v4 - with: - name: gem-x64-mingw32 - - - name: Install native gem and restore cross-compiled code from it - shell: pwsh - run: "& ./test/bin/restore-from-native-gem.ps1" - env: - RUBY_ARCHITECTURE: "x64-mingw32" - - - name: Setup MSSQL - uses: rails-sqlserver/setup-mssql@v1 - with: - components: sqlcmd,sqlengine - version: ${{ matrix.mssql-version }} - sa-password: c0MplicatedP@ssword - force-encryption: ${{ matrix.force-encryption }} - - - name: Setup MSSQL database - shell: pwsh - run: | - & sqlcmd -S localhost -U sa -P "c0MplicatedP@ssword" -i ./test/sql/db-create.sql - & sqlcmd -S localhost -U sa -P "c0MplicatedP@ssword" -i ./test/sql/db-login.sql - - - name: Install toxiproxy-server - shell: pwsh - run: | - choco install toxiproxy-server --version=2.5.0 -y - Start-Process toxiproxy-server - - - name: Test gem - shell: pwsh - run: bundle exec rake test - env: - TOXIPROXY_HOST: "localhost" - - - name: Test Summary - uses: test-summary/action@v2 - with: - paths: "test/reports/TEST-*.xml" - if: always() - install-windows-ucrt: needs: - cross-compile @@ -175,7 +59,6 @@ jobs: fail-fast: false matrix: ruby-version: - - "3.1" - "3.2" - "3.3" - "3.4" @@ -229,7 +112,6 @@ jobs: - 2019 - 2022 ruby-version: - - "3.1" - "3.2" - "3.3" - "3.4" @@ -292,12 +174,6 @@ jobs: fail-fast: false matrix: ruby-version: - # currently fails with a dependency resolution - # looking for conflicting packages... - # :: installing mingw-w64-x86_64-gcc-libs (15.1.0-8) breaks dependency 'mingw-w64-x86_64-gcc-libs=14.2.0-3' required by mingw-w64-x86_64-gcc - # - "2.7" - # - "3.0" - # - "3.1" - "3.2" - "3.3" - "3.4" @@ -353,9 +229,6 @@ jobs: - "aarch64-linux-musl" ruby-version: - - "2.7" - - "3.0" - - "3.1" - "3.2" - "3.3" - "3.4" @@ -363,7 +236,6 @@ jobs: include: - platform: x86_64-linux-musl docker_tag: "-alpine" - bootstrap: "apk add -U build-base &&" # required to compile bigdecimal on Ruby 2.7 - platform: aarch64-linux-gnu docker_platform: "--platform=linux/arm64" @@ -371,7 +243,6 @@ jobs: - platform: aarch64-linux-musl docker_platform: "--platform=linux/arm64" docker_tag: "-alpine" - bootstrap: "apk add -U build-base &&" name: install-linux runs-on: ubuntu-22.04 @@ -414,9 +285,6 @@ jobs: - 2022 ruby-version: - - "2.7" - - "3.0" - - "3.1" - "3.2" - "3.3" - "3.4" @@ -476,9 +344,6 @@ jobs: fail-fast: false matrix: ruby-version: - - "2.7" - - "3.0" - - "3.1" - "3.2" - "3.3" - "3.4" @@ -522,9 +387,6 @@ jobs: fail-fast: false matrix: ruby-version: - - "2.7" - - "3.0" - - "3.1" - "3.2" - "3.3" - "3.4" @@ -566,7 +428,7 @@ jobs: - uses: ruby/setup-ruby@v1 with: - ruby-version: "2.7" + ruby-version: "3.2" bundler-cache: true - name: Check standardrb diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ea8c4c5..5a4dd62d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## (unreleased) +* Drop support for Ruby < 3.2 + ## 3.3.0 * Use freetds v1.5.4 and OpenSSL v3.5.2 for Windows and Linux builds. diff --git a/README.md b/README.md index 04bb2bf6..da0c4bc8 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ The API is simple and consists of these classes: ## Install -tiny_tds is tested with Ruby v2.7 and upwards. +tiny_tds is tested with Ruby v3.2 and upwards. ### Windows and Linux (64-bit) diff --git a/Rakefile b/Rakefile index f1c7ed61..d2348e53 100644 --- a/Rakefile +++ b/Rakefile @@ -8,7 +8,6 @@ SPEC = Gem::Specification.load(File.expand_path("../tiny_tds.gemspec", __FILE__) CrossLibrary = Struct.new :platform, :openssl_config CrossLibraries = [ ["x64-mingw-ucrt", "mingw64"], - ["x64-mingw32", "mingw64"], ["x86_64-linux-gnu", "linux-x86_64"], ["x86_64-linux-musl", "linux-x86_64"], ["aarch64-linux-gnu", "linux-aarch64"], diff --git a/ext/tiny_tds/extconf.rb b/ext/tiny_tds/extconf.rb index ec155c14..e0585048 100644 --- a/ext/tiny_tds/extconf.rb +++ b/ext/tiny_tds/extconf.rb @@ -140,17 +140,11 @@ def configure_defaults /usr/local ] - if /darwin/i.match?(RbConfig::CONFIG["host_os"]) - # Ruby below 2.7 seems to label the host CPU on Apple Silicon as aarch64 - # 2.7 and above print is as ARM64 - target_host_cpu = (Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.7")) ? "aarch64" : "arm64" - - if RbConfig::CONFIG["host_cpu"] == target_host_cpu - # Homebrew on Apple Silicon installs into /opt/hombrew - # https://docs.brew.sh/Installation - # On Intel Macs, it is /usr/local, so no changes necessary to DIRS - DIRS.unshift("/opt/homebrew") - end + # Homebrew on Apple Silicon installs into /opt/hombrew + # https://docs.brew.sh/Installation + # On Intel Macs, it is /usr/local, so no changes necessary to DIRS + if /darwin/i.match?(RbConfig::CONFIG["host_os"]) && RbConfig::CONFIG["host_cpu"] == "arm64" + DIRS.unshift("/opt/homebrew") end if ENV["RI_DEVKIT"] && ENV["MINGW_PREFIX"] # RubyInstaller Support diff --git a/patches/freetds/1.00.27/0001-mingw_missing_inet_pton.diff b/patches/freetds/1.00.27/0001-mingw_missing_inet_pton.diff deleted file mode 100644 index ffefc8df..00000000 --- a/patches/freetds/1.00.27/0001-mingw_missing_inet_pton.diff +++ /dev/null @@ -1,34 +0,0 @@ -diff --git a/src/tds/tls.c b/src/tds/tls.c -index 09e7fa0..1da18f6 100644 ---- a/src/tds/tls.c -+++ b/src/tds/tls.c -@@ -101,6 +101,29 @@ - #define SSL_PTR BIO_get_data(bio) - #endif - -+/* -+ * Add a workaround for older Mingw versions without inet_pton(). -+ * This means RubyInstallers DevKit-4.7.2 in particular. -+ */ -+#if defined(__MINGW32__) && !defined(InetPtonA) -+ #include -+ -+ static HMODULE ws2_32 = NULL; -+ typedef INT (WINAPI * __inet_pton)(INT Family, LPCWSTR pStringBuf, PVOID pAddr); -+ static __inet_pton _inet_pton = NULL; -+ -+ INT WINAPI inet_pton(INT Family, LPCWSTR pStringBuf, PVOID pAddr) -+ { -+ if (_inet_pton == NULL) { -+ ws2_32 = LoadLibraryEx("Ws2_32.dll", NULL, 0); -+ -+ _inet_pton = (__inet_pton)GetProcAddress(ws2_32, "inet_pton"); -+ } -+ -+ return (_inet_pton)(Family, pStringBuf, pAddr); -+ } -+#endif -+ - static SSL_RET - tds_pull_func_login(SSL_PULL_ARGS) - { diff --git a/patches/freetds/1.00.27/0002-Don-t-use-MSYS2-file-libws2_32.diff b/patches/freetds/1.00.27/0002-Don-t-use-MSYS2-file-libws2_32.diff deleted file mode 100644 index 13b874cd..00000000 --- a/patches/freetds/1.00.27/0002-Don-t-use-MSYS2-file-libws2_32.diff +++ /dev/null @@ -1,28 +0,0 @@ -From 56e8972f66c3e948e2ad6885595c58fd23dcdb37 Mon Sep 17 00:00:00 2001 -From: Lars Kanis -Date: Thu, 6 Jul 2017 17:09:40 +0200 -Subject: [PATCH] Don't use MSYS2 file libws2_32.a for MINGW build - -This file is intended for MSYS2/cygwin builds and blocks OpenSSL -detection of freetds on i686. ---- - configure | 2 -- - configure.ac | 2 -- - 2 files changed, 4 deletions(-) - -diff --git a/configure b/configure -index 9495a49..31eb01d 100644 ---- a/configure -+++ b/configure -@@ -15915,8 +15915,6 @@ case $host in - tds_mingw=yes - if test "$host_cpu" = "x86_64"; then - LIBS="-lws2_32" -- elif test -r /usr/lib/w32api/libws2_32.a; then -- LIBS="-L/usr/lib/w32api -lws2_32" - else - LIBS="-lws2_32" - fi --- -2.6.2.windows.1 - diff --git a/tasks/native_gem.rake b/tasks/native_gem.rake index f35cb661..36d321b9 100644 --- a/tasks/native_gem.rake +++ b/tasks/native_gem.rake @@ -7,7 +7,7 @@ CrossLibraries.each do |xlib| RakeCompilerDock.sh <<-EOT, platform: platform bundle install && - rake native:#{platform} pkg/#{SPEC.full_name}-#{platform}.gem MAKEOPTS=-j`nproc` RUBY_CC_VERSION=#{RakeCompilerDock.set_ruby_cc_version("~> 2.7", "~> 3.0")} MAKEFLAGS="V=1" + rake native:#{platform} pkg/#{SPEC.full_name}-#{platform}.gem MAKEOPTS=-j`nproc` RUBY_CC_VERSION=#{RakeCompilerDock.set_ruby_cc_version("~> 3.2")} MAKEFLAGS="V=1" EOT end diff --git a/tiny_tds.gemspec b/tiny_tds.gemspec index 9ec0a05d..54611259 100644 --- a/tiny_tds.gemspec +++ b/tiny_tds.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| s.rdoc_options = ["--charset=UTF-8"] s.extensions = ["ext/tiny_tds/extconf.rb"] s.license = "MIT" - s.required_ruby_version = ">= 2.7.0" + s.required_ruby_version = ">= 3.2.0" s.metadata["msys2_mingw_dependencies"] = "freetds" s.add_dependency "bigdecimal", "~> 3" s.add_development_dependency "mini_portile2", "~> 2.8.0" From 6187d8614d98ef8ad6b3fdf05f318960b34aeed9 Mon Sep 17 00:00:00 2001 From: Andy Pfister Date: Mon, 8 Sep 2025 15:01:35 +0200 Subject: [PATCH 3/6] Remove `.rubocop.yml` --- .rubocop.yml | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 .rubocop.yml diff --git a/.rubocop.yml b/.rubocop.yml deleted file mode 100644 index e20a0d8c..00000000 --- a/.rubocop.yml +++ /dev/null @@ -1,31 +0,0 @@ - -AllCops: - Include: - - '**/Rakefile' - Exclude: - - 'ext/**/*' - - 'ports/**/*' - - 'test/**/*' - - 'tmp/**/*' - -# Redefined - -Metrics/LineLength: - Max: 120 - -Metrics/ClassLength: - Max: 200 - -# Disabled - -Style/Documentation: - Enabled: false - -Style/EmptyLinesAroundClassBody: - Enabled: false - -Style/EmptyLinesAroundModuleBody: - Enabled: false - -Style/EmptyLinesAroundBlockBody: - Enabled: false From 9db3d45331026a686694df3251f07e3055d93c81 Mon Sep 17 00:00:00 2001 From: Andy Pfister Date: Mon, 8 Sep 2025 15:08:34 +0200 Subject: [PATCH 4/6] Update gems --- test/schema_test.rb | 4 ++-- tiny_tds.gemspec | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/schema_test.rb b/test/schema_test.rb index 4e8456d5..34087f69 100644 --- a/test/schema_test.rb +++ b/test/schema_test.rb @@ -120,8 +120,8 @@ class SchemaTest < TinyTds::TestCase it "casts numeric" do assert_instance_of BigDecimal, find_value(191, :numeric_18_0) - assert_equal BigDecimal("191"), find_value(191, :numeric_18_0) - assert_equal BigDecimal("123456789012345678"), find_value(192, :numeric_18_0) + assert_equal BigDecimal(191), find_value(191, :numeric_18_0) + assert_equal BigDecimal(123456789012345678), find_value(192, :numeric_18_0) assert_equal BigDecimal("12345678901234567890.01"), find_value(193, :numeric_36_2) assert_equal BigDecimal("123.46"), find_value(194, :numeric_36_2) end diff --git a/tiny_tds.gemspec b/tiny_tds.gemspec index 54611259..38991c61 100644 --- a/tiny_tds.gemspec +++ b/tiny_tds.gemspec @@ -20,12 +20,12 @@ Gem::Specification.new do |s| s.metadata["msys2_mingw_dependencies"] = "freetds" s.add_dependency "bigdecimal", "~> 3" s.add_development_dependency "mini_portile2", "~> 2.8.0" - s.add_development_dependency "rake", "~> 13.0.0" + s.add_development_dependency "rake", "~> 13.0" s.add_development_dependency "rake-compiler", "~> 1.2" s.add_development_dependency "rake-compiler-dock", "~> 1.9.1" s.add_development_dependency "minitest", "~> 5.25" - s.add_development_dependency "minitest-reporters", "~> 1.6.1" - s.add_development_dependency "connection_pool", "~> 2.2.0" + s.add_development_dependency "minitest-reporters", "~> 1.7.1" + s.add_development_dependency "connection_pool", "~> 2.5.0" s.add_development_dependency "toxiproxy", "~> 2.0.0" - s.add_development_dependency "standard", "~> 1.31.0" + s.add_development_dependency "standard", "~> 1.50.0" end From 37a51e1b2985c49e2fd83f2623a24d775d77ea35 Mon Sep 17 00:00:00 2001 From: Andy Pfister Date: Fri, 1 Aug 2025 13:53:55 +0200 Subject: [PATCH 5/6] Mention to compile `tiny_tds` --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index da0c4bc8..bef605eb 100644 --- a/README.md +++ b/README.md @@ -413,6 +413,7 @@ From within the container, you can run the tests using the following command: ```shell bundle install +bundle exec rake compile bundle exec rake test ``` From 6239d74b1c3b8ea953f1ff9990bd3cbab1d9d00c Mon Sep 17 00:00:00 2001 From: Andy Pfister Date: Mon, 8 Sep 2025 15:18:07 +0200 Subject: [PATCH 6/6] Drop support for SQL Server 2017 --- .github/workflows/ci.yml | 5 ++--- CHANGELOG.md | 1 + README.md | 2 +- test/schema/{sqlserver_2017.sql => sqlserver_2019.sql} | 0 test/test_helper.rb | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) rename test/schema/{sqlserver_2017.sql => sqlserver_2019.sql} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a619bdad..60ad7d3e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,6 @@ jobs: - false - true mssql-version: - - 2017 - 2019 - 2022 ruby-version: @@ -138,7 +137,7 @@ jobs: RUBY_ARCHITECTURE: "x64-mingw-ucrt" - name: Setup MSSQL - uses: rails-sqlserver/setup-mssql@v1 + uses: rails-sqlserver/setup-mssql@v2 with: components: sqlcmd,sqlengine version: ${{ matrix.mssql-version }} @@ -310,7 +309,7 @@ jobs: RUBY_ARCHITECTURE: "x86_64-linux-gnu" - name: Setup MSSQL - uses: rails-sqlserver/setup-mssql@v1 + uses: rails-sqlserver/setup-mssql@v2 with: components: sqlcmd,sqlengine version: ${{ matrix.mssql-version }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a4dd62d..ec29c740 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## (unreleased) * Drop support for Ruby < 3.2 +* Drop support for SQL Server < 2019 ## 3.3.0 diff --git a/README.md b/README.md index bef605eb..d4929032 100644 --- a/README.md +++ b/README.md @@ -420,7 +420,7 @@ bundle exec rake test You can customize the environment variables to run the tests against a different environment ```shell -rake test TINYTDS_UNIT_DATASERVER=mydbserver TINYTDS_SCHEMA=sqlserver_2017 +rake test TINYTDS_UNIT_DATASERVER=mydbserver TINYTDS_SCHEMA=sqlserver_2019 rake test TINYTDS_UNIT_HOST=mydb.host.net TINYTDS_SCHEMA=sqlserver_azure ``` diff --git a/test/schema/sqlserver_2017.sql b/test/schema/sqlserver_2019.sql similarity index 100% rename from test/schema/sqlserver_2017.sql rename to test/schema/sqlserver_2019.sql diff --git a/test/test_helper.rb b/test/test_helper.rb index f5ac46d3..aab1f3e9 100755 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -7,13 +7,13 @@ require "minitest/reporters" Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new, Minitest::Reporters::JUnitReporter.new] -TINYTDS_SCHEMAS = ["sqlserver_2017", "sqlserver_azure"].freeze +TINYTDS_SCHEMAS = ["sqlserver_2019", "sqlserver_azure"].freeze module TinyTds class TestCase < Minitest::Spec class << self def current_schema - ENV["TINYTDS_SCHEMA"] || "sqlserver_2017" + ENV["TINYTDS_SCHEMA"] || "sqlserver_2019" end TINYTDS_SCHEMAS.each do |schema|