tiny_tds 3.1.0 → 3.2.1
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 +4 -4
- data/.github/workflows/ci.yml +188 -94
- data/CHANGELOG.md +13 -0
- data/Gemfile +1 -1
- data/README.md +59 -50
- data/Rakefile +46 -37
- data/VERSION +1 -1
- data/ext/tiny_tds/extconf.rb +169 -70
- data/ext/tiny_tds/extconsts.rb +3 -4
- data/lib/tiny_tds/bin.rb +12 -26
- data/lib/tiny_tds/client.rb +38 -42
- data/lib/tiny_tds/error.rb +0 -2
- data/lib/tiny_tds/gem.rb +5 -9
- data/lib/tiny_tds/result.rb +0 -2
- data/lib/tiny_tds/version.rb +1 -1
- data/lib/tiny_tds.rb +28 -47
- data/tasks/native_gem.rake +11 -18
- data/tasks/package.rake +1 -3
- data/tasks/ports.rake +7 -91
- data/tasks/test.rake +3 -5
- data/test/bin/install-freetds.sh +2 -4
- data/test/bin/restore-from-native-gem.ps1 +10 -0
- data/test/client_test.rb +106 -112
- data/test/gem_test.rb +31 -107
- data/test/result_test.rb +208 -221
- data/test/schema_test.rb +177 -181
- data/test/test_helper.rb +58 -63
- data/test/thread_test.rb +22 -31
- data/tiny_tds.gemspec +28 -29
- metadata +21 -13
- data/tasks/ports/freetds.rb +0 -32
- data/tasks/ports/libiconv.rb +0 -26
- data/tasks/ports/openssl.rb +0 -62
- data/tasks/ports/recipe.rb +0 -64
- data/test/benchmark/query.rb +0 -77
- data/test/benchmark/query_odbc.rb +0 -106
- data/test/benchmark/query_tinytds.rb +0 -126
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfb4ec4fbcdaee13a7f5e8dbcf6640dfba4adfa44f785224400a088b9dce4238
|
4
|
+
data.tar.gz: 8030a777d32c4dcc5dc5916dd599cef31388ed5f7288a593871189ef46fbb4b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 327cd3c216f474994c6215714f5394d2e190b7db3d730224259532fe98c98076d801baf97503efa34e8c1cb495b880242989c0a085765f420d3b59fd1e4f2b6d
|
7
|
+
data.tar.gz: 3f75d35aed67db12f7505c503be4c76b6ccced517865dd0776612afe8af2c0c19e6ccd53f31ff4d29a55017a16ed27e4e4cdf16979e20e0dd5dec9772c15f937
|
data/.github/workflows/ci.yml
CHANGED
@@ -13,17 +13,22 @@ jobs:
|
|
13
13
|
platform:
|
14
14
|
- "x64-mingw32"
|
15
15
|
- "x64-mingw-ucrt"
|
16
|
-
|
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.7.0-mri-${{ matrix.platform }}"
|
20
23
|
steps:
|
21
24
|
- uses: actions/checkout@v4
|
22
25
|
|
23
|
-
-
|
26
|
+
- name: Set up Ruby
|
27
|
+
uses: ruby/setup-ruby@v1
|
28
|
+
with:
|
29
|
+
ruby-version: "2.7"
|
24
30
|
|
25
|
-
- name: Install
|
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-
|
42
|
+
key: cross-compiled-v1-${{ matrix.platform }}-${{ hashFiles('**/.ports_versions') }}
|
38
43
|
restore-keys: |
|
39
|
-
cross-compiled-
|
40
|
-
cross-compiled-
|
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:
|
49
|
+
run: bundle exec rake gem:native:${{ matrix.platform }}
|
45
50
|
|
46
51
|
- uses: actions/upload-artifact@v4
|
47
52
|
with:
|
@@ -61,8 +66,6 @@ jobs:
|
|
61
66
|
name: install-windows-mingw
|
62
67
|
runs-on: windows-latest
|
63
68
|
steps:
|
64
|
-
- uses: actions/checkout@v4
|
65
|
-
|
66
69
|
- uses: ruby/setup-ruby@v1
|
67
70
|
with:
|
68
71
|
ruby-version: ${{ matrix.ruby-version }}
|
@@ -75,13 +78,7 @@ jobs:
|
|
75
78
|
|
76
79
|
- name: Install native gem
|
77
80
|
shell: pwsh
|
78
|
-
run:
|
79
|
-
$rubyArchitecture = (ruby -e "puts RbConfig::CONFIG['arch']").Trim()
|
80
|
-
$gemVersion = (Get-Content VERSION).Trim()
|
81
|
-
$gemToInstall = "./tiny_tds-$gemVersion-$rubyArchitecture.gem"
|
82
|
-
|
83
|
-
Write-Host "Looking to install $gemToInstall"
|
84
|
-
gem install "$gemToInstall"
|
81
|
+
run: gem install "tiny_tds-*.gem"
|
85
82
|
|
86
83
|
- name: Test if TinyTDS loads
|
87
84
|
shell: pwsh
|
@@ -89,6 +86,18 @@ jobs:
|
|
89
86
|
ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
|
90
87
|
exit $LASTEXITCODE
|
91
88
|
|
89
|
+
- name: Test if tsql wrapper works
|
90
|
+
shell: pwsh
|
91
|
+
run: |
|
92
|
+
tsql-ttds -C
|
93
|
+
exit $LASTEXITCODE
|
94
|
+
|
95
|
+
- name: Test if defncopy wrapper works
|
96
|
+
shell: pwsh
|
97
|
+
run: |
|
98
|
+
defncopy-ttds -v
|
99
|
+
exit $LASTEXITCODE
|
100
|
+
|
92
101
|
test-windows-mingw:
|
93
102
|
needs:
|
94
103
|
- cross-compile
|
@@ -123,21 +132,9 @@ jobs:
|
|
123
132
|
|
124
133
|
- name: Install native gem and restore cross-compiled code from it
|
125
134
|
shell: pwsh
|
126
|
-
run:
|
127
|
-
|
128
|
-
|
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
|
135
|
+
run: "& ./test/bin/restore-from-native-gem.ps1"
|
136
|
+
env:
|
137
|
+
RUBY_ARCHITECTURE: "x64-mingw32"
|
141
138
|
|
142
139
|
- name: Setup MSSQL
|
143
140
|
uses: rails-sqlserver/setup-mssql@v1
|
@@ -186,8 +183,6 @@ jobs:
|
|
186
183
|
name: install-windows-ucrt
|
187
184
|
runs-on: windows-latest
|
188
185
|
steps:
|
189
|
-
- uses: actions/checkout@v4
|
190
|
-
|
191
186
|
- uses: ruby/setup-ruby@v1
|
192
187
|
with:
|
193
188
|
ruby-version: ${{ matrix.ruby-version }}
|
@@ -200,13 +195,7 @@ jobs:
|
|
200
195
|
|
201
196
|
- name: Install native gem
|
202
197
|
shell: pwsh
|
203
|
-
run:
|
204
|
-
$rubyArchitecture = (ruby -e "puts RbConfig::CONFIG['arch']").Trim()
|
205
|
-
$gemVersion = (Get-Content VERSION).Trim()
|
206
|
-
$gemToInstall = "./tiny_tds-$gemVersion-$rubyArchitecture.gem"
|
207
|
-
|
208
|
-
Write-Host "Looking to install $gemToInstall"
|
209
|
-
gem install "$gemToInstall"
|
198
|
+
run: gem install "tiny_tds-*.gem"
|
210
199
|
|
211
200
|
- name: Test if TinyTDS loads
|
212
201
|
shell: pwsh
|
@@ -214,6 +203,18 @@ jobs:
|
|
214
203
|
ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
|
215
204
|
exit $LASTEXITCODE
|
216
205
|
|
206
|
+
- name: Test if tsql wrapper works
|
207
|
+
shell: pwsh
|
208
|
+
run: |
|
209
|
+
tsql-ttds -C
|
210
|
+
exit $LASTEXITCODE
|
211
|
+
|
212
|
+
- name: Test if defncopy wrapper works
|
213
|
+
shell: pwsh
|
214
|
+
run: |
|
215
|
+
defncopy-ttds -v
|
216
|
+
exit $LASTEXITCODE
|
217
|
+
|
217
218
|
test-windows-ucrt:
|
218
219
|
needs:
|
219
220
|
- cross-compile
|
@@ -250,21 +251,9 @@ jobs:
|
|
250
251
|
|
251
252
|
- name: Install native gem and restore cross-compiled code from it
|
252
253
|
shell: pwsh
|
253
|
-
run:
|
254
|
-
|
255
|
-
|
256
|
-
$gemToUnpack = "./tiny_tds-$gemVersion-$rubyArchitecture.gem"
|
257
|
-
|
258
|
-
Write-Host "Looking to unpack $gemToUnpack"
|
259
|
-
gem unpack --target ./tmp "$gemToUnpack"
|
260
|
-
|
261
|
-
# Restore precompiled code
|
262
|
-
$source = (Resolve-Path ".\tmp\tiny_tds-$gemVersion-$rubyArchitecture\lib\tiny_tds").Path
|
263
|
-
$destination = (Resolve-Path ".\lib\tiny_tds").Path
|
264
|
-
Get-ChildItem $source -Recurse -Exclude "*.rb" | Copy-Item -Destination {Join-Path $destination $_.FullName.Substring($source.length)}
|
265
|
-
|
266
|
-
# Restore ports
|
267
|
-
Copy-Item -Path ".\tmp\tiny_tds-$gemVersion-$rubyArchitecture\ports" -Destination "." -Recurse
|
254
|
+
run: "& ./test/bin/restore-from-native-gem.ps1"
|
255
|
+
env:
|
256
|
+
RUBY_ARCHITECTURE: "x64-mingw-ucrt"
|
268
257
|
|
269
258
|
- name: Setup MSSQL
|
270
259
|
uses: rails-sqlserver/setup-mssql@v1
|
@@ -336,44 +325,91 @@ jobs:
|
|
336
325
|
ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
|
337
326
|
exit $LASTEXITCODE
|
338
327
|
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
328
|
+
- name: Test if tsql wrapper works
|
329
|
+
shell: pwsh
|
330
|
+
run: |
|
331
|
+
tsql-ttds -C
|
332
|
+
exit $LASTEXITCODE
|
344
333
|
|
345
|
-
-
|
346
|
-
|
347
|
-
|
348
|
-
|
334
|
+
- name: Test if defncopy wrapper works
|
335
|
+
shell: pwsh
|
336
|
+
run: |
|
337
|
+
defncopy-ttds -v
|
338
|
+
exit $LASTEXITCODE
|
349
339
|
|
350
|
-
|
351
|
-
|
340
|
+
install-linux:
|
341
|
+
needs:
|
342
|
+
- cross-compile
|
343
|
+
strategy:
|
344
|
+
fail-fast: false
|
345
|
+
matrix:
|
346
|
+
platform:
|
347
|
+
- "x86_64-linux-gnu"
|
348
|
+
- "x86_64-linux-musl"
|
349
|
+
- "aarch64-linux-gnu"
|
350
|
+
- "aarch64-linux-musl"
|
352
351
|
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
native-v3-
|
352
|
+
ruby-version:
|
353
|
+
- "2.7"
|
354
|
+
- "3.0"
|
355
|
+
- "3.1"
|
356
|
+
- "3.2"
|
357
|
+
- "3.3"
|
358
|
+
- "3.4"
|
361
359
|
|
362
|
-
|
363
|
-
|
364
|
-
|
360
|
+
include:
|
361
|
+
- platform: x86_64-linux-musl
|
362
|
+
docker_tag: "-alpine"
|
363
|
+
bootstrap: "apk add -U build-base &&" # required to compile bigdecimal on Ruby 2.7
|
364
|
+
|
365
|
+
- platform: aarch64-linux-gnu
|
366
|
+
docker_platform: "--platform=linux/arm64"
|
367
|
+
|
368
|
+
- platform: aarch64-linux-musl
|
369
|
+
docker_platform: "--platform=linux/arm64"
|
370
|
+
docker_tag: "-alpine"
|
371
|
+
bootstrap: "apk add -U build-base &&"
|
372
|
+
|
373
|
+
name: install-linux
|
374
|
+
runs-on: ubuntu-22.04
|
375
|
+
steps:
|
376
|
+
- name: Download precompiled gem
|
377
|
+
uses: actions/download-artifact@v4
|
378
|
+
with:
|
379
|
+
name: gem-${{ matrix.platform }}
|
380
|
+
path: precompiled/gems
|
381
|
+
|
382
|
+
- name: Setup QEMU for docker
|
383
|
+
uses: docker/setup-qemu-action@v3
|
384
|
+
if: ${{ matrix.docker_platform }} != ''
|
385
|
+
|
386
|
+
- run: |
|
387
|
+
docker run --rm -v $PWD/precompiled:/precompiled -w /precompiled \
|
388
|
+
${{ matrix.docker_platform }} ruby:${{ matrix.ruby-version }}${{ matrix.docker_tag }} \
|
389
|
+
sh -c "
|
390
|
+
gem update --system 3.3.22 &&
|
391
|
+
${{ matrix.bootstrap }}
|
392
|
+
gem install --no-document ./gems/tiny_tds-*.gem &&
|
393
|
+
ruby -e \"require 'tiny_tds'; puts TinyTds::Gem.root_path\" &&
|
394
|
+
tsql-ttds -C &&
|
395
|
+
defncopy-ttds -v
|
396
|
+
"
|
365
397
|
|
366
398
|
test-linux:
|
367
399
|
needs:
|
368
|
-
- compile
|
400
|
+
- cross-compile
|
369
401
|
name: test-linux
|
370
402
|
strategy:
|
371
403
|
fail-fast: false
|
372
404
|
matrix:
|
405
|
+
force-encryption:
|
406
|
+
- false
|
407
|
+
- true
|
408
|
+
|
373
409
|
mssql-version:
|
374
|
-
- 2017
|
375
410
|
- 2019
|
376
411
|
- 2022
|
412
|
+
|
377
413
|
ruby-version:
|
378
414
|
- "2.7"
|
379
415
|
- "3.0"
|
@@ -391,20 +427,16 @@ jobs:
|
|
391
427
|
ruby-version: ${{ matrix.ruby-version }}
|
392
428
|
bundler-cache: true
|
393
429
|
|
394
|
-
- name:
|
395
|
-
|
396
|
-
bundle exec rake ports:version_file
|
397
|
-
|
398
|
-
- name: Cache ports
|
399
|
-
uses: actions/cache@v4
|
430
|
+
- name: Download precompiled gem
|
431
|
+
uses: actions/download-artifact@v4
|
400
432
|
with:
|
401
|
-
|
402
|
-
key: native-v3-${{ hashFiles('**/.ports_versions') }}
|
403
|
-
fail-on-cache-miss: true
|
433
|
+
name: gem-x86_64-linux-gnu
|
404
434
|
|
405
|
-
- name:
|
406
|
-
|
407
|
-
|
435
|
+
- name: Install native gem and restore cross-compiled code from it
|
436
|
+
shell: pwsh
|
437
|
+
run: "& ./test/bin/restore-from-native-gem.ps1"
|
438
|
+
env:
|
439
|
+
RUBY_ARCHITECTURE: "x86_64-linux-gnu"
|
408
440
|
|
409
441
|
- name: Setup MSSQL
|
410
442
|
uses: rails-sqlserver/setup-mssql@v1
|
@@ -412,6 +444,7 @@ jobs:
|
|
412
444
|
components: sqlcmd,sqlengine
|
413
445
|
version: ${{ matrix.mssql-version }}
|
414
446
|
sa-password: "c0MplicatedP@ssword"
|
447
|
+
force-encryption: ${{ matrix.force-encryption }}
|
415
448
|
|
416
449
|
- name: Setup MSSQL database
|
417
450
|
run: |
|
@@ -435,6 +468,52 @@ jobs:
|
|
435
468
|
paths: "test/reports/TEST-*.xml"
|
436
469
|
if: always()
|
437
470
|
|
471
|
+
install-linux-native:
|
472
|
+
strategy:
|
473
|
+
fail-fast: false
|
474
|
+
matrix:
|
475
|
+
ruby-version:
|
476
|
+
- "2.7"
|
477
|
+
- "3.0"
|
478
|
+
- "3.1"
|
479
|
+
- "3.2"
|
480
|
+
- "3.3"
|
481
|
+
- "3.4"
|
482
|
+
|
483
|
+
name: install-linux-native
|
484
|
+
runs-on: ubuntu-22.04
|
485
|
+
steps:
|
486
|
+
- uses: actions/checkout@v4
|
487
|
+
|
488
|
+
- uses: ruby/setup-ruby@v1
|
489
|
+
with:
|
490
|
+
ruby-version: ${{ matrix.ruby-version }}
|
491
|
+
bundler-cache: true
|
492
|
+
|
493
|
+
- name: Install FreeTDS
|
494
|
+
shell: bash
|
495
|
+
run: ./test/bin/install-freetds.sh
|
496
|
+
|
497
|
+
- name: Build gem
|
498
|
+
shell: bash
|
499
|
+
run: gem build tiny_tds.gemspec
|
500
|
+
|
501
|
+
- name: Install gem
|
502
|
+
shell: bash
|
503
|
+
run: gem install "tiny_tds-$(cat VERSION).gem"
|
504
|
+
|
505
|
+
- name: Test if TinyTDS loads
|
506
|
+
shell: bash
|
507
|
+
run: ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
|
508
|
+
|
509
|
+
- name: Test if tsql wrapper works
|
510
|
+
shell: bash
|
511
|
+
run: tsql-ttds -C
|
512
|
+
|
513
|
+
- name: Test if defncopy wrapper works
|
514
|
+
shell: bash
|
515
|
+
run: defncopy-ttds -v
|
516
|
+
|
438
517
|
install_macos:
|
439
518
|
strategy:
|
440
519
|
fail-fast: false
|
@@ -475,3 +554,18 @@ jobs:
|
|
475
554
|
shell: bash
|
476
555
|
run: |
|
477
556
|
ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
|
557
|
+
|
558
|
+
standardrb:
|
559
|
+
name: standardrb
|
560
|
+
runs-on: ubuntu-22.04
|
561
|
+
steps:
|
562
|
+
- uses: actions/checkout@v4
|
563
|
+
|
564
|
+
- uses: ruby/setup-ruby@v1
|
565
|
+
with:
|
566
|
+
ruby-version: "2.7"
|
567
|
+
bundler-cache: true
|
568
|
+
|
569
|
+
- name: Check standardrb
|
570
|
+
shell: bash
|
571
|
+
run: bundle exec standardrb
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## 3.2.1
|
2
|
+
|
3
|
+
* Ensure the native Gem loads on Windows. Fixes #581.
|
4
|
+
* Use OpenSSL v3.4.1 for Windows and Linux builds.
|
5
|
+
|
6
|
+
## 3.2.0
|
7
|
+
|
8
|
+
* Reduce number of files shipped with precompiled Windows gem
|
9
|
+
* Provide precompiled gem for Linux (GNU + MUSL / 64-bit x86 + ARM)
|
10
|
+
* Fix wrappers for `tsql` and `defncopy` utility.
|
11
|
+
* Use libiconv v1.18 and freetds v1.4.26 for Windows and Linux builds
|
12
|
+
|
1
13
|
## 3.1.0
|
2
14
|
|
3
15
|
* Add Ruby 3.4 to the cross compile list
|
@@ -13,6 +25,7 @@
|
|
13
25
|
* Add `bigdecimal` to dependencies
|
14
26
|
|
15
27
|
## 2.1.7
|
28
|
+
|
16
29
|
* Add Ruby 3.3 to the cross compile list
|
17
30
|
|
18
31
|
## 2.1.6
|
data/Gemfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
source
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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.
|
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
|
-
|
442
|
+
### Code formatting
|
450
443
|
|
451
|
-
|
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
|
-
|
455
|
-
|
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
|
-
|
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>.
|