tiny_tds 3.0.0-x64-mingw32 → 3.2.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +194 -74
  3. data/CHANGELOG.md +12 -0
  4. data/Gemfile +1 -1
  5. data/README.md +59 -50
  6. data/Rakefile +46 -37
  7. data/VERSION +1 -1
  8. data/ext/tiny_tds/extconf.rb +169 -70
  9. data/ext/tiny_tds/extconsts.rb +3 -4
  10. data/lib/tiny_tds/2.7/tiny_tds.so +0 -0
  11. data/lib/tiny_tds/3.0/tiny_tds.so +0 -0
  12. data/lib/tiny_tds/bin.rb +12 -26
  13. data/lib/tiny_tds/client.rb +38 -42
  14. data/lib/tiny_tds/error.rb +0 -2
  15. data/lib/tiny_tds/gem.rb +5 -9
  16. data/lib/tiny_tds/result.rb +0 -2
  17. data/lib/tiny_tds/version.rb +1 -1
  18. data/lib/tiny_tds.rb +28 -47
  19. data/ports/x64-mingw32/{freetds/1.4.23/bin → bin}/defncopy.exe +0 -0
  20. data/ports/x64-mingw32/bin/libsybdb-5.dll +0 -0
  21. data/ports/x64-mingw32/bin/tsql.exe +0 -0
  22. data/tasks/native_gem.rake +11 -18
  23. data/tasks/package.rake +1 -3
  24. data/tasks/ports.rake +7 -91
  25. data/tasks/test.rake +3 -5
  26. data/test/bin/install-freetds.sh +2 -4
  27. data/test/bin/restore-from-native-gem.ps1 +10 -0
  28. data/test/client_test.rb +106 -112
  29. data/test/gem_test.rb +32 -108
  30. data/test/result_test.rb +208 -221
  31. data/test/schema_test.rb +177 -181
  32. data/test/test_helper.rb +59 -64
  33. data/test/thread_test.rb +22 -31
  34. data/tiny_tds.gemspec +28 -29
  35. metadata +27 -43
  36. data/ports/x64-mingw32/freetds/1.4.23/bin/bsqldb.exe +0 -0
  37. data/ports/x64-mingw32/freetds/1.4.23/bin/datacopy.exe +0 -0
  38. data/ports/x64-mingw32/freetds/1.4.23/bin/freebcp.exe +0 -0
  39. data/ports/x64-mingw32/freetds/1.4.23/bin/libct-4.dll +0 -0
  40. data/ports/x64-mingw32/freetds/1.4.23/bin/libsybdb-5.dll +0 -0
  41. data/ports/x64-mingw32/freetds/1.4.23/bin/osql +0 -393
  42. data/ports/x64-mingw32/freetds/1.4.23/bin/tdspool.exe +0 -0
  43. data/ports/x64-mingw32/freetds/1.4.23/bin/tsql.exe +0 -0
  44. data/ports/x64-mingw32/freetds/1.4.23/lib/libct.dll.a +0 -0
  45. data/ports/x64-mingw32/freetds/1.4.23/lib/libct.la +0 -41
  46. data/ports/x64-mingw32/freetds/1.4.23/lib/libsybdb.dll.a +0 -0
  47. data/ports/x64-mingw32/freetds/1.4.23/lib/libsybdb.la +0 -41
  48. data/ports/x64-mingw32/libiconv/1.17/bin/iconv.exe +0 -0
  49. data/ports/x64-mingw32/libiconv/1.17/bin/libcharset-1.dll +0 -0
  50. data/ports/x64-mingw32/libiconv/1.17/bin/libiconv-2.dll +0 -0
  51. data/ports/x64-mingw32/libiconv/1.17/lib/libcharset.dll.a +0 -0
  52. data/ports/x64-mingw32/libiconv/1.17/lib/libcharset.la +0 -41
  53. data/ports/x64-mingw32/libiconv/1.17/lib/libiconv.dll.a +0 -0
  54. data/ports/x64-mingw32/libiconv/1.17/lib/libiconv.la +0 -41
  55. data/ports/x64-mingw32/openssl/3.4.0/bin/c_rehash +0 -252
  56. data/ports/x64-mingw32/openssl/3.4.0/bin/libcrypto-3-x64.dll +0 -0
  57. data/ports/x64-mingw32/openssl/3.4.0/bin/libssl-3-x64.dll +0 -0
  58. data/ports/x64-mingw32/openssl/3.4.0/bin/openssl.exe +0 -0
  59. data/tasks/ports/freetds.rb +0 -32
  60. data/tasks/ports/libiconv.rb +0 -26
  61. data/tasks/ports/openssl.rb +0 -62
  62. data/tasks/ports/recipe.rb +0 -64
  63. data/test/benchmark/query.rb +0 -77
  64. data/test/benchmark/query_odbc.rb +0 -106
  65. data/test/benchmark/query_tinytds.rb +0 -126
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7920342a1747d7a9e8107358be37ac8db3f7293b356def2eb7b8916fc99f87f9
4
- data.tar.gz: 9bbc67a08e6e21857478674e14554bf9ccf685027f230131e756f2fee4c610d4
3
+ metadata.gz: 661ae25a8fe66dca380e127cd6618bc996f6cbf9d0042acf332fbb16af182c57
4
+ data.tar.gz: eb09ce7c6e0d912454352f2c3c0c778be6c2300a6bf827ece29e2ffde4a151ad
5
5
  SHA512:
6
- metadata.gz: 58c816544106e0cc84bdb18ca59d82b10bb23007b995baecaa546f6555de219769d4a8ecd17f6177e0613cac6560763159293e846b4c06bd38d6fd7db7a9d07f
7
- data.tar.gz: 4ebcd36a86a32f00d69b278488f4b6bbd93e9760626e5e812e91a1533318fca759c42bab1b63705c432814a904658cc2a6f3cb462d70bcfd85c948fb22f59f9d
6
+ metadata.gz: 1c3504bca6edaf0e5935681d4e0bb119c8920e7ad58fe2189dcf9f8eda4d83a5b8c67fcbacd27d69d78c9d8be7b00e3095f3538139eb345e5a78a9f4b8a98ccd
7
+ data.tar.gz: b8b820b26e8be0e56f6f53569a37387557a8f82c8228d20a971d13f685566a605a6d91908b7feb7b0e6a841ba11f95825f760f15a9f5b0a96ae28bbe2891cf25
@@ -13,17 +13,22 @@ jobs:
13
13
  platform:
14
14
  - "x64-mingw32"
15
15
  - "x64-mingw-ucrt"
16
- name: cross-compile-windows
16
+ - "x86_64-linux-gnu"
17
+ - "x86_64-linux-musl"
18
+ - "aarch64-linux-gnu"
19
+ - "aarch64-linux-musl"
20
+
21
+ name: cross-compile
17
22
  runs-on: ubuntu-22.04
18
- container:
19
- image: "ghcr.io/rake-compiler/rake-compiler-dock-image:1.4.0-mri-${{ matrix.platform }}"
20
23
  steps:
21
24
  - uses: actions/checkout@v4
22
25
 
23
- - run: git config --global --add safe.directory /__w/tiny_tds/tiny_tds # shrug
26
+ - name: Set up Ruby
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: "2.7"
24
30
 
25
- - name: Install gems
26
- shell: bash
31
+ - name: "Install dependencies"
27
32
  run: bundle install
28
33
 
29
34
  - name: Write used versions into file
@@ -34,14 +39,14 @@ jobs:
34
39
  uses: actions/cache@v4
35
40
  with:
36
41
  path: ports
37
- key: cross-compiled-v3-${{ matrix.platform }}-${{ hashFiles('**/.ports_versions') }}
42
+ key: cross-compiled-v1-${{ matrix.platform }}-${{ hashFiles('**/.ports_versions') }}
38
43
  restore-keys: |
39
- cross-compiled-v3-${{ matrix.platform }}-${{ hashFiles('**/.ports_versions') }}
40
- cross-compiled-v3-${{ matrix.platform }}-
44
+ cross-compiled-v1-${{ matrix.platform }}-${{ hashFiles('**/.ports_versions') }}
45
+ cross-compiled-v1-${{ matrix.platform }}-
41
46
 
42
47
  - name: Build gem
43
48
  shell: bash
44
- run: bundle exec rake gem:for_platform[${{ matrix.platform }}]
49
+ run: bundle exec rake gem:native:${{ matrix.platform }}
45
50
 
46
51
  - uses: actions/upload-artifact@v4
47
52
  with:
@@ -89,6 +94,18 @@ jobs:
89
94
  ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
90
95
  exit $LASTEXITCODE
91
96
 
97
+ - name: Test if tsql wrapper works
98
+ shell: pwsh
99
+ run: |
100
+ tsql-ttds -C
101
+ exit $LASTEXITCODE
102
+
103
+ - name: Test if defncopy wrapper works
104
+ shell: pwsh
105
+ run: |
106
+ defncopy-ttds -v
107
+ exit $LASTEXITCODE
108
+
92
109
  test-windows-mingw:
93
110
  needs:
94
111
  - cross-compile
@@ -123,21 +140,9 @@ jobs:
123
140
 
124
141
  - name: Install native gem and restore cross-compiled code from it
125
142
  shell: pwsh
126
- run: |
127
- $rubyArchitecture = (ruby -e "puts RbConfig::CONFIG['arch']").Trim()
128
- $gemVersion = (Get-Content VERSION).Trim()
129
- $gemToUnpack = "./tiny_tds-$gemVersion-$rubyArchitecture.gem"
130
-
131
- Write-Host "Looking to unpack $gemToUnpack"
132
- gem unpack --target ./tmp "$gemToUnpack"
133
-
134
- # Restore precompiled code
135
- $source = (Resolve-Path ".\tmp\tiny_tds-$gemVersion-$rubyArchitecture\lib\tiny_tds").Path
136
- $destination = (Resolve-Path ".\lib\tiny_tds").Path
137
- Get-ChildItem $source -Recurse -Exclude "*.rb" | Copy-Item -Destination {Join-Path $destination $_.FullName.Substring($source.length)}
138
-
139
- # Restore ports
140
- Copy-Item -Path ".\tmp\tiny_tds-$gemVersion-$rubyArchitecture\ports" -Destination "." -Recurse
143
+ run: "& ./test/bin/restore-from-native-gem.ps1"
144
+ env:
145
+ RUBY_ARCHITECTURE: "x64-mingw32"
141
146
 
142
147
  - name: Setup MSSQL
143
148
  uses: rails-sqlserver/setup-mssql@v1
@@ -181,6 +186,7 @@ jobs:
181
186
  - "3.1"
182
187
  - "3.2"
183
188
  - "3.3"
189
+ - "3.4"
184
190
 
185
191
  name: install-windows-ucrt
186
192
  runs-on: windows-latest
@@ -213,6 +219,18 @@ jobs:
213
219
  ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
214
220
  exit $LASTEXITCODE
215
221
 
222
+ - name: Test if tsql wrapper works
223
+ shell: pwsh
224
+ run: |
225
+ tsql-ttds -C
226
+ exit $LASTEXITCODE
227
+
228
+ - name: Test if defncopy wrapper works
229
+ shell: pwsh
230
+ run: |
231
+ defncopy-ttds -v
232
+ exit $LASTEXITCODE
233
+
216
234
  test-windows-ucrt:
217
235
  needs:
218
236
  - cross-compile
@@ -230,6 +248,8 @@ jobs:
230
248
  - "3.1"
231
249
  - "3.2"
232
250
  - "3.3"
251
+ - "3.4"
252
+
233
253
  name: test-windows-ucrt
234
254
  runs-on: windows-latest
235
255
  steps:
@@ -247,21 +267,9 @@ jobs:
247
267
 
248
268
  - name: Install native gem and restore cross-compiled code from it
249
269
  shell: pwsh
250
- run: |
251
- $rubyArchitecture = (ruby -e "puts RbConfig::CONFIG['arch']").Trim()
252
- $gemVersion = (Get-Content VERSION).Trim()
253
- $gemToUnpack = "./tiny_tds-$gemVersion-$rubyArchitecture.gem"
254
-
255
- Write-Host "Looking to unpack $gemToUnpack"
256
- gem unpack --target ./tmp "$gemToUnpack"
257
-
258
- # Restore precompiled code
259
- $source = (Resolve-Path ".\tmp\tiny_tds-$gemVersion-$rubyArchitecture\lib\tiny_tds").Path
260
- $destination = (Resolve-Path ".\lib\tiny_tds").Path
261
- Get-ChildItem $source -Recurse -Exclude "*.rb" | Copy-Item -Destination {Join-Path $destination $_.FullName.Substring($source.length)}
262
-
263
- # Restore ports
264
- Copy-Item -Path ".\tmp\tiny_tds-$gemVersion-$rubyArchitecture\ports" -Destination "." -Recurse
270
+ run: "& ./test/bin/restore-from-native-gem.ps1"
271
+ env:
272
+ RUBY_ARCHITECTURE: "x64-mingw-ucrt"
265
273
 
266
274
  - name: Setup MSSQL
267
275
  uses: rails-sqlserver/setup-mssql@v1
@@ -305,6 +313,7 @@ jobs:
305
313
  - "3.1"
306
314
  - "3.2"
307
315
  - "3.3"
316
+ - "3.4"
308
317
 
309
318
  name: install-windows-native
310
319
  runs-on: windows-latest
@@ -332,50 +341,102 @@ jobs:
332
341
  ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
333
342
  exit $LASTEXITCODE
334
343
 
335
- compile-native-ports:
344
+ - name: Test if tsql wrapper works
345
+ shell: pwsh
346
+ run: |
347
+ tsql-ttds -C
348
+ exit $LASTEXITCODE
349
+
350
+ - name: Test if defncopy wrapper works
351
+ shell: pwsh
352
+ run: |
353
+ defncopy-ttds -v
354
+ exit $LASTEXITCODE
355
+
356
+ install-linux:
357
+ needs:
358
+ - cross-compile
359
+ strategy:
360
+ fail-fast: false
361
+ matrix:
362
+ platform:
363
+ - "x86_64-linux-gnu"
364
+ - "x86_64-linux-musl"
365
+ - "aarch64-linux-gnu"
366
+ - "aarch64-linux-musl"
367
+
368
+ ruby-version:
369
+ - "2.7"
370
+ - "3.0"
371
+ - "3.1"
372
+ - "3.2"
373
+ - "3.3"
374
+ - "3.4"
375
+
376
+ include:
377
+ - platform: x86_64-linux-musl
378
+ docker_tag: "-alpine"
379
+ bootstrap: "apk add -U build-base &&" # required to compile bigdecimal on Ruby 2.7
380
+
381
+ - platform: aarch64-linux-gnu
382
+ docker_platform: "--platform=linux/arm64"
383
+
384
+ - platform: aarch64-linux-musl
385
+ docker_platform: "--platform=linux/arm64"
386
+ docker_tag: "-alpine"
387
+ bootstrap: "apk add -U build-base &&"
388
+
389
+ name: install-linux
336
390
  runs-on: ubuntu-22.04
337
- name: cross-compile-linux
338
391
  steps:
339
392
  - uses: actions/checkout@v4
340
393
 
341
- - uses: ruby/setup-ruby@v1
342
- with:
343
- ruby-version: 3.3
344
- bundler-cache: true
345
-
346
- - name: Write used versions into file
347
- run: bundle exec rake ports:version_file
348
-
349
- - name: Cache ports
350
- uses: actions/cache@v4
394
+ - name: Download precompiled gem
395
+ uses: actions/download-artifact@v4
351
396
  with:
352
- path: ports
353
- key: native-v3-${{ hashFiles('**/.ports_versions') }}
354
- restore-keys: |
355
- native-v3-${{ hashFiles('* */.ports_versions') }}
356
- native-v3-
357
-
358
- - name: Build required libraries
359
- run: |
360
- bundle exec rake ports
397
+ name: gem-${{ matrix.platform }}
398
+ path: precompiled/gems
399
+
400
+ - name: Setup QEMU for docker
401
+ uses: docker/setup-qemu-action@v3
402
+ if: ${{ matrix.docker_platform }} != ''
403
+
404
+ - run: |
405
+ docker run --rm -v $PWD/precompiled:/precompiled -w /precompiled \
406
+ ${{ matrix.docker_platform }} ruby:${{ matrix.ruby-version }}${{ matrix.docker_tag }} \
407
+ sh -c "
408
+ gem update --system 3.3.22 &&
409
+ ${{ matrix.bootstrap }}
410
+ gem install --no-document ./gems/tiny_tds-$(cat VERSION)-${{ matrix.platform }}.gem &&
411
+ ruby -e \"require 'tiny_tds'; puts TinyTds::Gem.root_path\" &&
412
+ tsql-ttds -C &&
413
+ defncopy-ttds -v
414
+ "
361
415
 
362
416
  test-linux:
363
417
  needs:
364
- - compile-native-ports
418
+ - cross-compile
365
419
  name: test-linux
366
420
  strategy:
367
421
  fail-fast: false
368
422
  matrix:
423
+ force-encryption:
424
+ - false
425
+ - true
426
+
369
427
  mssql-version:
370
428
  - 2017
371
429
  - 2019
372
430
  - 2022
431
+
373
432
  ruby-version:
374
433
  - "2.7"
375
434
  - "3.0"
376
435
  - "3.1"
377
436
  - "3.2"
378
437
  - "3.3"
438
+ - "3.4"
439
+
379
440
  runs-on: ubuntu-22.04
380
441
  steps:
381
442
  - uses: actions/checkout@v4
@@ -385,20 +446,16 @@ jobs:
385
446
  ruby-version: ${{ matrix.ruby-version }}
386
447
  bundler-cache: true
387
448
 
388
- - name: Write used versions into file
389
- run: |
390
- bundle exec rake ports:version_file
391
-
392
- - name: Cache ports
393
- uses: actions/cache@v4
449
+ - name: Download precompiled gem
450
+ uses: actions/download-artifact@v4
394
451
  with:
395
- path: ports
396
- key: native-v3-${{ hashFiles('**/.ports_versions') }}
397
- fail-on-cache-miss: true
452
+ name: gem-x86_64-linux-gnu
398
453
 
399
- - name: Build gem
400
- run: |
401
- bundle exec rake build
454
+ - name: Install native gem and restore cross-compiled code from it
455
+ shell: pwsh
456
+ run: "& ./test/bin/restore-from-native-gem.ps1"
457
+ env:
458
+ RUBY_ARCHITECTURE: "x86_64-linux-gnu"
402
459
 
403
460
  - name: Setup MSSQL
404
461
  uses: rails-sqlserver/setup-mssql@v1
@@ -406,6 +463,7 @@ jobs:
406
463
  components: sqlcmd,sqlengine
407
464
  version: ${{ matrix.mssql-version }}
408
465
  sa-password: "c0MplicatedP@ssword"
466
+ force-encryption: ${{ matrix.force-encryption }}
409
467
 
410
468
  - name: Setup MSSQL database
411
469
  run: |
@@ -429,6 +487,52 @@ jobs:
429
487
  paths: "test/reports/TEST-*.xml"
430
488
  if: always()
431
489
 
490
+ install-linux-native:
491
+ strategy:
492
+ fail-fast: false
493
+ matrix:
494
+ ruby-version:
495
+ - "2.7"
496
+ - "3.0"
497
+ - "3.1"
498
+ - "3.2"
499
+ - "3.3"
500
+ - "3.4"
501
+
502
+ name: install-linux-native
503
+ runs-on: ubuntu-22.04
504
+ steps:
505
+ - uses: actions/checkout@v4
506
+
507
+ - uses: ruby/setup-ruby@v1
508
+ with:
509
+ ruby-version: ${{ matrix.ruby-version }}
510
+ bundler-cache: true
511
+
512
+ - name: Install FreeTDS
513
+ shell: bash
514
+ run: ./test/bin/install-freetds.sh
515
+
516
+ - name: Build gem
517
+ shell: bash
518
+ run: gem build tiny_tds.gemspec
519
+
520
+ - name: Install gem
521
+ shell: bash
522
+ run: gem install "tiny_tds-$(cat VERSION).gem"
523
+
524
+ - name: Test if TinyTDS loads
525
+ shell: bash
526
+ run: ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
527
+
528
+ - name: Test if tsql wrapper works
529
+ shell: bash
530
+ run: tsql-ttds -C
531
+
532
+ - name: Test if defncopy wrapper works
533
+ shell: bash
534
+ run: defncopy-ttds -v
535
+
432
536
  install_macos:
433
537
  strategy:
434
538
  fail-fast: false
@@ -439,6 +543,7 @@ jobs:
439
543
  - "3.1"
440
544
  - "3.2"
441
545
  - "3.3"
546
+ - "3.4"
442
547
 
443
548
  name: install-macos-m1
444
549
  runs-on: macos-14
@@ -468,3 +573,18 @@ jobs:
468
573
  shell: bash
469
574
  run: |
470
575
  ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
576
+
577
+ standardrb:
578
+ name: standardrb
579
+ runs-on: ubuntu-22.04
580
+ steps:
581
+ - uses: actions/checkout@v4
582
+
583
+ - uses: ruby/setup-ruby@v1
584
+ with:
585
+ ruby-version: "2.7"
586
+ bundler-cache: true
587
+
588
+ - name: Check standardrb
589
+ shell: bash
590
+ run: bundle exec standardrb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 3.2.0
2
+
3
+ * Reduce number of files shipped with precompiled Windows gem
4
+ * Provide precompiled gem for Linux (GNU + MUSL / 64-bit x86 + ARM)
5
+ * Fix wrappers for `tsql` and `defncopy` utility.
6
+ * Use libiconv v1.18 and freetds v1.4.26 for Windows and Linux builds
7
+
8
+ ## 3.1.0
9
+
10
+ * Add Ruby 3.4 to the cross compile list
11
+
1
12
  ## 3.0.0
2
13
 
3
14
  * Drop support for Ruby < 2.7
@@ -9,6 +20,7 @@
9
20
  * Add `bigdecimal` to dependencies
10
21
 
11
22
  ## 2.1.7
23
+
12
24
  * Add Ruby 3.3 to the cross compile list
13
25
 
14
26
  ## 2.1.6
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
  gemspec
data/README.md CHANGED
@@ -18,16 +18,42 @@ The API is simple and consists of these classes:
18
18
 
19
19
  ## Install
20
20
 
21
- Installing with rubygems should just work. TinyTDS is currently tested on Ruby version 2.7.0 and upward.
21
+ tiny_tds is tested with Ruby v2.7 and upwards.
22
22
 
23
+ ### Windows and Linux (64-bit)
24
+
25
+ We precompile tiny_tds with FreeTDS and supporting libraries, which are dynamically linked at runtime. Therefore, you can run:
26
+
27
+ ```shell
28
+ gem install tiny_tds
23
29
  ```
24
- $ gem install tiny_tds
30
+
31
+ It should find the platform-specific gem.
32
+
33
+ You can also avoid getting the platform-specific gem if you want to compile FreeTDS and supporting libraries yourself:
34
+
35
+ ```shell
36
+ gem install tiny_tds --platform ruby
25
37
  ```
26
38
 
27
- If you use Windows, we pre-compile TinyTDS with static versions of FreeTDS and supporting libraries.
28
- If you're using RubyInstaller, the binary gem will require that devkit is installed and in your path to operate properly.
39
+ ### Mac
29
40
 
30
- On all other platforms, we will find these dependencies. It is recommended that you install the latest FreeTDS via your method of choice. For example, here is how to install FreeTDS on Ubuntu. You might also need the `build-essential` and possibly the `libc6-dev` packages.
41
+ Install FreeTDS via Homebrew:
42
+
43
+ ```shell
44
+ brew install openssl@3 libiconv
45
+ brew install freetds
46
+ ```
47
+
48
+ Then you can install tiny_tds:
49
+
50
+ ```shell
51
+ gem install tiny_tds
52
+ ```
53
+
54
+ ### Everybody else
55
+
56
+ `tiny_tds` will find FreeTDS and other libraries based on your compiler paths. Below you can see an example on how to install FreeTDS on a Debian system.
31
57
 
32
58
  ```shell
33
59
  $ apt-get install wget
@@ -37,41 +63,21 @@ $ apt-get install libc6-dev
37
63
  $ wget http://www.freetds.org/files/stable/freetds-1.4.23.tar.gz
38
64
  $ tar -xzf freetds-1.4.23.tar.gz
39
65
  $ cd freetds-1.4.23
40
- $ ./configure --prefix=/usr/local --with-tdsver=7.4
66
+ $ ./configure --prefix=/usr/local --with-tdsver=7.4 --disable-odbc
41
67
  $ make
42
68
  $ make install
43
69
  ```
44
70
 
45
- Please read the MiniPortile and/or Windows sections at the end of this file for advanced configuration options past the following:
71
+ You can also tell `tiny_tds` where to find your FreeTDS installation.
46
72
 
73
+ ```shell
74
+ gem install tiny_tds -- --with-freetds-dir=/opt/freetds
47
75
  ```
48
- --with-freetds-dir=DIR
49
- Use the freetds library placed under DIR.
50
- ```
51
-
52
76
 
53
77
  ## Getting Started
54
78
 
55
79
  Optionally, Microsoft has done a great job writing [an article](https://learn.microsoft.com/en-us/sql/connect/ruby/ruby-driver-for-sql-server?view=sql-server-ver16) on how to get started with SQL Server and Ruby using TinyTDS, however, the articles are using outdated versions.
56
80
 
57
-
58
- ## FreeTDS Compatibility & Configuration
59
-
60
- TinyTDS is developed against FreeTDs 1.1+. We also test with SQL Server 2017, 2019, 2022 and Azure. Older version of SQL Server or FreeTDS could work, but are not supported.
61
-
62
- > [!IMPORTANT]
63
- >
64
- > Windows users of our pre-compiled native gems need not worry about installing FreeTDS and its dependencies.
65
-
66
- * **Do I need to install FreeTDS?** Yes! Somehow, someway, you are going to need FreeTDS for TinyTDS to compile against.
67
-
68
- * **OK, I am installing FreeTDS, how do I configure it?** Contrary to what most people think, you do not need to specially configure FreeTDS in any way for client libraries like TinyTDS to use it. About the only requirement is that you compile it with libiconv for proper encoding support. FreeTDS must also be compiled with OpenSSL (or the like) to use it with Azure. See the "Using TinyTDS with Azure" section below for more info.
69
-
70
- * **Do I need to configure `--with-tdsver` equal to anything?** Most likely! Technically you should not have to. This is only a default for clients/configs that do not specify what TDS version they want to use. We are currently having issues with passing down a TDS version with the login bit. Till we get that fixed, if you are not using a freetds.conf or a TDSVER environment variable, then make sure to use 7.4.
71
-
72
- * **I want to configure FreeTDS using `--enable-msdblib` and/or `--enable-sybase-compat` so it works for my database. Cool?** It's a waste of time and totally moot! Client libraries like TinyTDS define their own C structure names where they diverge from Sybase to SQL Server. Technically we use the MSDBLIB structures which does not mean we only work with that database vs Sybase. These configs are just a low level default for C libraries that do not define what they want. So I repeat, you do not NEED to use any of these, nor will they hurt anything since we control what C structure names we use internally!
73
-
74
-
75
81
  ## Data Types
76
82
 
77
83
  Our goal is to support every SQL Server data type and covert it to a logical Ruby object. When dates or times are returned, they are instantiated to either `:utc` or `:local` time depending on the query options. Only [datetimeoffset] types are excluded. All strings are associated the to the connection's encoding and all binary data types are associated to Ruby's `ASCII-8BIT/BINARY` encoding.
@@ -387,19 +393,6 @@ Please read our [thread_test.rb](https://github.com/rails-sqlserver/tiny_tds/blo
387
393
 
388
394
  This is possible. Since FreeTDS v1.0, utf-16 is enabled by default and supported by tiny_tds. You can toggle it by using `use_utf16` when establishing the connection.
389
395
 
390
- ## Compiling Gems for Windows
391
-
392
- For the convenience of Windows users, TinyTDS ships pre-compiled gems for supported versions of Ruby on Windows. In order to generate these gems, [rake-compiler-dock](https://github.com/rake-compiler/rake-compiler-dock) is used. This project provides several [Docker images](https://registry.hub.docker.com/u/larskanis/) with rvm, cross-compilers and a number of different target versions of Ruby.
393
-
394
- Run the following rake task to compile the gems for Windows. This will check the availability of [Docker](https://www.docker.com/) (and boot2docker on Windows or OS-X) and will give some advice for download and installation. When docker is running, it will download the docker image (once-only) and start the build:
395
-
396
- ```
397
- $ rake gem:native
398
- ```
399
-
400
- The compiled gems will exist in `./pkg` directory.
401
-
402
-
403
396
  ## Development & Testing
404
397
 
405
398
  First, clone the repo using the command line or your Git GUI of choice.
@@ -446,16 +439,32 @@ $ rake TINYTDS_UNIT_DATASERVER=mydbserver TINYTDS_SCHEMA=sqlserver_2017
446
439
  $ rake TINYTDS_UNIT_HOST=mydb.host.net TINYTDS_SCHEMA=sqlserver_azure
447
440
  ```
448
441
 
449
- ## Docker Builds
442
+ ### Code formatting
450
443
 
451
- If you use a [multi stage](https://docs.docker.com/develop/develop-images/multistage-build/) Docker build to assemble your gems in one phase and then copy your app and gems
452
- into another, lighter, container without build tools you will need to make sure you tell the OS how to find dependencies for TinyTDS.
444
+ We are using `standardrb` to format our code. Just run `bundle exec standardrb --fix` to format all Ruby files.
453
445
 
454
- After you have built and installed FreeTDS it will normally place library files in `/usr/local/lib`. When TinyTDS builds native extensions,
455
- it [already knows to look here](https://github.com/rails-sqlserver/tiny_tds/blob/master/ext/tiny_tds/extconf.rb#L31) but if you copy your app to a new container that link will be broken.
446
+ ### Compiling Gems for Windows and Linux
447
+
448
+ > [!WARNING]
449
+ > Compiling the Gems on native Windows currently does not work.
450
+
451
+ For the convenience, TinyTDS ships pre-compiled gems for supported versions of Ruby on Windows and Linux. In order to generate these gems, [rake-compiler-dock](https://github.com/rake-compiler/rake-compiler-dock) is used.
452
+
453
+ Run the following rake task to compile the gems. This will check the availability of [Docker](https://www.docker.com/) and will give some advice for download and installation. When docker is running, it will download the docker image (once-only) and start the build:
454
+
455
+ ```shell
456
+ bundle exec rake gem:native
457
+ ```
458
+
459
+ The compiled gems will exist in `./pkg` directory.
460
+
461
+ If you only need a specific gem for one platform and architecture, run this command:
462
+
463
+ ```shell
464
+ bundle exec rake gem:native:x64-mingw-ucrt
465
+ ```
456
466
 
457
- Set the LD_LIBRARY_PATH environment variable `export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}` and run `ldconfig`. If you run `ldd tiny_tds.so` you should not see any broken links. Make
458
- sure you also copied in the library dependencies from your build container with a command like `COPY --from=builder /usr/local/lib /usr/local/lib`.
467
+ All the supported architectures and platforms are listed in the `Rakefile` in the `CrossLibraries` constant.
459
468
 
460
469
  ## Help & Support
461
470
 
@@ -481,4 +490,4 @@ My name is Ken Collins and I currently maintain the SQL Server adapter for Activ
481
490
 
482
491
  ## License
483
492
 
484
- TinyTDS is Copyright (c) 2010-2015 Ken Collins, <ken@metaskills.net> and Will Bond (Veracross LLC) <wbond@breuer.com>. It is distributed under the MIT license. Windows binaries contain pre-compiled versions of FreeTDS <http://www.freetds.org/> which is licensed under the GNU LGPL license at <http://www.gnu.org/licenses/lgpl-2.0.html>
493
+ TinyTDS is Copyright (c) 2010-2015 Ken Collins, <ken@metaskills.net> and Will Bond (Veracross LLC) <wbond@breuer.com>. It is distributed under the MIT license. Windows and Linux binaries contain pre-compiled versions of FreeTDS <http://www.freetds.org/> and `libconv` which is licensed under the GNU LGPL license at <http://www.gnu.org/licenses/lgpl-2.0.html>. They also contain OpenSSL, which is licensed under the OpenSSL license at <https://openssl-library.org/source/license/index.html>.