tiny_tds 2.1.7 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49ea08772f73e8682ea03d9bc715612d3719d395a0f88aa13925ad0d264a7769
4
- data.tar.gz: 5da3fb070e68241ab548c0afc74dbcbc1b2bc38b58b38a58788c9ca93c0d65b1
3
+ metadata.gz: 6b414774cfa843b715b006c293997efc9c41e7166d5f0bb730253564ba21a319
4
+ data.tar.gz: 6e4609d32b55b051ce5578bea58c9b154cafa71913473bc9fdc036ff110be754
5
5
  SHA512:
6
- metadata.gz: 79e1cdec5c9129f5ffb032e17e8c3506ceb9aa1319009d68defe1710c04df56f05c12ca07d8e00d6d145056356e97232f6d6a0e791ee8f2c2d89b87001585b47
7
- data.tar.gz: b5b9ec330dcbceacef5371376a242b2e629eead159915fe449780fbf6e5f3e99d3ce99103ca75c2df7b3d42d398bfe1f94fd824bb59de98e82bd61b0a84f99ba
6
+ metadata.gz: 1b52cdf3a47058ca14e54d8f86f584b1ed2a878aad8fa40dee756e4021022efcf9f3f31de8598dc057f397406d7384727c5d9bad18b329c4286de1aff60226f0
7
+ data.tar.gz: 2592253cfb513f39d6df67c7c9f6e23ea22fa6c036f149525ad4d6075f4b2e9b7962df87da94cb5c92ae990b552f84ca91db7371b69207c022f4dd329d288db3
@@ -0,0 +1,470 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ cross-compile:
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ platform:
14
+ - "x64-mingw32"
15
+ - "x64-mingw-ucrt"
16
+ name: cross-compile-windows
17
+ runs-on: ubuntu-22.04
18
+ container:
19
+ image: "ghcr.io/rake-compiler/rake-compiler-dock-image:1.4.0-mri-${{ matrix.platform }}"
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+
23
+ - run: git config --global --add safe.directory /__w/tiny_tds/tiny_tds # shrug
24
+
25
+ - name: Install gems
26
+ shell: bash
27
+ run: bundle install
28
+
29
+ - name: Write used versions into file
30
+ shell: bash
31
+ run: bundle exec rake ports:version_file[${{ matrix.platform }}]
32
+
33
+ - name: Cache ports
34
+ uses: actions/cache@v4
35
+ with:
36
+ path: ports
37
+ key: cross-compiled-v3-${{ matrix.platform }}-${{ hashFiles('**/.ports_versions') }}
38
+ restore-keys: |
39
+ cross-compiled-v3-${{ matrix.platform }}-${{ hashFiles('**/.ports_versions') }}
40
+ cross-compiled-v3-${{ matrix.platform }}-
41
+
42
+ - name: Build gem
43
+ shell: bash
44
+ run: bundle exec rake gem:for_platform[${{ matrix.platform }}]
45
+
46
+ - uses: actions/upload-artifact@v4
47
+ with:
48
+ name: gem-${{ matrix.platform }}
49
+ path: pkg/*.gem
50
+
51
+ install-windows-mingw:
52
+ needs:
53
+ - cross-compile
54
+ strategy:
55
+ fail-fast: false
56
+ matrix:
57
+ ruby-version:
58
+ - "2.7"
59
+ - "3.0"
60
+
61
+ name: install-windows-mingw
62
+ runs-on: windows-latest
63
+ steps:
64
+ - uses: actions/checkout@v4
65
+
66
+ - uses: ruby/setup-ruby@v1
67
+ with:
68
+ ruby-version: ${{ matrix.ruby-version }}
69
+ bundler-cache: true
70
+
71
+ - name: Download precompiled gem
72
+ uses: actions/download-artifact@v4
73
+ with:
74
+ name: gem-x64-mingw32
75
+
76
+ - name: Install native gem
77
+ 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"
85
+
86
+ - name: Test if TinyTDS loads
87
+ shell: pwsh
88
+ run: |
89
+ ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
90
+ exit $LASTEXITCODE
91
+
92
+ test-windows-mingw:
93
+ needs:
94
+ - cross-compile
95
+ strategy:
96
+ fail-fast: false
97
+ matrix:
98
+ force-encryption:
99
+ - false
100
+ - true
101
+ mssql-version:
102
+ - 2017
103
+ - 2019
104
+ - 2022
105
+ ruby-version:
106
+ - "2.7"
107
+ - "3.0"
108
+
109
+ name: test-windows-mingw
110
+ runs-on: windows-latest
111
+ steps:
112
+ - uses: actions/checkout@v4
113
+
114
+ - uses: ruby/setup-ruby@v1
115
+ with:
116
+ ruby-version: ${{ matrix.ruby-version }}
117
+ bundler-cache: true
118
+
119
+ - name: Download precompiled gem
120
+ uses: actions/download-artifact@v4
121
+ with:
122
+ name: gem-x64-mingw32
123
+
124
+ - name: Install native gem and restore cross-compiled code from it
125
+ 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
141
+
142
+ - name: Setup MSSQL
143
+ uses: rails-sqlserver/setup-mssql@v1
144
+ with:
145
+ components: sqlcmd,sqlengine
146
+ version: ${{ matrix.mssql-version }}
147
+ sa-password: c0MplicatedP@ssword
148
+ force-encryption: ${{ matrix.force-encryption }}
149
+
150
+ - name: Setup MSSQL database
151
+ shell: pwsh
152
+ run: |
153
+ & sqlcmd -S localhost -U sa -P "c0MplicatedP@ssword" -i ./test/sql/db-create.sql
154
+ & sqlcmd -S localhost -U sa -P "c0MplicatedP@ssword" -i ./test/sql/db-login.sql
155
+
156
+ - name: Install toxiproxy-server
157
+ shell: pwsh
158
+ run: |
159
+ choco install toxiproxy-server --version=2.5.0 -y
160
+ Start-Process toxiproxy-server
161
+
162
+ - name: Test gem
163
+ shell: pwsh
164
+ run: bundle exec rake test
165
+ env:
166
+ TOXIPROXY_HOST: "localhost"
167
+
168
+ - name: Test Summary
169
+ uses: test-summary/action@v2
170
+ with:
171
+ paths: "test/reports/TEST-*.xml"
172
+ if: always()
173
+
174
+ install-windows-ucrt:
175
+ needs:
176
+ - cross-compile
177
+ strategy:
178
+ fail-fast: false
179
+ matrix:
180
+ ruby-version:
181
+ - "3.1"
182
+ - "3.2"
183
+ - "3.3"
184
+
185
+ name: install-windows-ucrt
186
+ runs-on: windows-latest
187
+ steps:
188
+ - uses: actions/checkout@v4
189
+
190
+ - uses: ruby/setup-ruby@v1
191
+ with:
192
+ ruby-version: ${{ matrix.ruby-version }}
193
+ bundler-cache: true
194
+
195
+ - name: Download precompiled gem
196
+ uses: actions/download-artifact@v4
197
+ with:
198
+ name: gem-x64-mingw-ucrt
199
+
200
+ - name: Install native gem
201
+ shell: pwsh
202
+ run: |
203
+ $rubyArchitecture = (ruby -e "puts RbConfig::CONFIG['arch']").Trim()
204
+ $gemVersion = (Get-Content VERSION).Trim()
205
+ $gemToInstall = "./tiny_tds-$gemVersion-$rubyArchitecture.gem"
206
+
207
+ Write-Host "Looking to install $gemToInstall"
208
+ gem install "$gemToInstall"
209
+
210
+ - name: Test if TinyTDS loads
211
+ shell: pwsh
212
+ run: |
213
+ ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
214
+ exit $LASTEXITCODE
215
+
216
+ test-windows-ucrt:
217
+ needs:
218
+ - cross-compile
219
+ strategy:
220
+ fail-fast: false
221
+ matrix:
222
+ force-encryption:
223
+ - false
224
+ - true
225
+ mssql-version:
226
+ - 2017
227
+ - 2019
228
+ - 2022
229
+ ruby-version:
230
+ - "3.1"
231
+ - "3.2"
232
+ - "3.3"
233
+ name: test-windows-ucrt
234
+ runs-on: windows-latest
235
+ steps:
236
+ - uses: actions/checkout@v4
237
+
238
+ - uses: ruby/setup-ruby@v1
239
+ with:
240
+ ruby-version: ${{ matrix.ruby-version }}
241
+ bundler-cache: true
242
+
243
+ - name: Download precompiled gem
244
+ uses: actions/download-artifact@v4
245
+ with:
246
+ name: gem-x64-mingw-ucrt
247
+
248
+ - name: Install native gem and restore cross-compiled code from it
249
+ 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
265
+
266
+ - name: Setup MSSQL
267
+ uses: rails-sqlserver/setup-mssql@v1
268
+ with:
269
+ components: sqlcmd,sqlengine
270
+ version: ${{ matrix.mssql-version }}
271
+ sa-password: c0MplicatedP@ssword
272
+ force-encryption: ${{ matrix.force-encryption }}
273
+
274
+ - name: Setup MSSQL database
275
+ shell: pwsh
276
+ run: |
277
+ & sqlcmd -S localhost -U sa -P "c0MplicatedP@ssword" -i ./test/sql/db-create.sql
278
+ & sqlcmd -S localhost -U sa -P "c0MplicatedP@ssword" -i ./test/sql/db-login.sql
279
+
280
+ - name: Install toxiproxy-server
281
+ shell: pwsh
282
+ run: |
283
+ choco install toxiproxy-server --version=2.5.0 -y
284
+ Start-Process toxiproxy-server
285
+
286
+ - name: Test gem
287
+ shell: pwsh
288
+ run: bundle exec rake test
289
+ env:
290
+ TOXIPROXY_HOST: "localhost"
291
+
292
+ - name: Test Summary
293
+ uses: test-summary/action@v2
294
+ with:
295
+ paths: "test/reports/TEST-*.xml"
296
+ if: always()
297
+
298
+ install-windows-native:
299
+ strategy:
300
+ fail-fast: false
301
+ matrix:
302
+ ruby-version:
303
+ - "2.7"
304
+ - "3.0"
305
+ - "3.1"
306
+ - "3.2"
307
+ - "3.3"
308
+
309
+ name: install-windows-native
310
+ runs-on: windows-latest
311
+ steps:
312
+ - uses: actions/checkout@v4
313
+
314
+ - uses: ruby/setup-ruby@v1
315
+ with:
316
+ ruby-version: ${{ matrix.ruby-version }}
317
+ bundler-cache: true
318
+
319
+ - name: Build gem
320
+ shell: pwsh
321
+ run: gem build tiny_tds.gemspec
322
+
323
+ - name: Install gem
324
+ shell: pwsh
325
+ run: |
326
+ $gemVersion = (Get-Content VERSION).Trim()
327
+ gem install "tiny_tds-$gemVersion.gem"
328
+
329
+ - name: Test if TinyTDS loads
330
+ shell: pwsh
331
+ run: |
332
+ ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
333
+ exit $LASTEXITCODE
334
+
335
+ compile-native-ports:
336
+ runs-on: ubuntu-22.04
337
+ name: cross-compile-linux
338
+ steps:
339
+ - uses: actions/checkout@v4
340
+
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
351
+ 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
361
+
362
+ test-linux:
363
+ needs:
364
+ - compile-native-ports
365
+ name: test-linux
366
+ strategy:
367
+ fail-fast: false
368
+ matrix:
369
+ mssql-version:
370
+ - 2017
371
+ - 2019
372
+ - 2022
373
+ ruby-version:
374
+ - "2.7"
375
+ - "3.0"
376
+ - "3.1"
377
+ - "3.2"
378
+ - "3.3"
379
+ runs-on: ubuntu-22.04
380
+ steps:
381
+ - uses: actions/checkout@v4
382
+
383
+ - uses: ruby/setup-ruby@v1
384
+ with:
385
+ ruby-version: ${{ matrix.ruby-version }}
386
+ bundler-cache: true
387
+
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
394
+ with:
395
+ path: ports
396
+ key: native-v3-${{ hashFiles('**/.ports_versions') }}
397
+ fail-on-cache-miss: true
398
+
399
+ - name: Build gem
400
+ run: |
401
+ bundle exec rake build
402
+
403
+ - name: Setup MSSQL
404
+ uses: rails-sqlserver/setup-mssql@v1
405
+ with:
406
+ components: sqlcmd,sqlengine
407
+ version: ${{ matrix.mssql-version }}
408
+ sa-password: "c0MplicatedP@ssword"
409
+
410
+ - name: Setup MSSQL database
411
+ run: |
412
+ sqlcmd -S localhost -U sa -P "c0MplicatedP@ssword" -i ./test/sql/db-create.sql
413
+ sqlcmd -S localhost -U sa -P "c0MplicatedP@ssword" -i ./test/sql/db-login.sql
414
+
415
+ - name: Install toxiproxy-server
416
+ run: |
417
+ wget -O toxiproxy-2.5.0.deb https://github.com/Shopify/toxiproxy/releases/download/v2.5.0/toxiproxy_2.5.0_linux_amd64.deb
418
+ sudo dpkg -i toxiproxy-2.5.0.deb
419
+ sudo toxiproxy-server &
420
+
421
+ - name: Run tests
422
+ run: bundle exec rake test
423
+ env:
424
+ TOXIPROXY_HOST: "localhost"
425
+
426
+ - name: Test Summary
427
+ uses: test-summary/action@v2
428
+ with:
429
+ paths: "test/reports/TEST-*.xml"
430
+ if: always()
431
+
432
+ install_macos:
433
+ strategy:
434
+ fail-fast: false
435
+ matrix:
436
+ ruby-version:
437
+ - "2.7"
438
+ - "3.0"
439
+ - "3.1"
440
+ - "3.2"
441
+ - "3.3"
442
+
443
+ name: install-macos-m1
444
+ runs-on: macos-14
445
+ steps:
446
+ - uses: actions/checkout@v4
447
+
448
+ - name: Install FreeTDS
449
+ run: brew install freetds
450
+ shell: bash
451
+
452
+ - uses: ruby/setup-ruby@v1
453
+ with:
454
+ ruby-version: ${{ matrix.ruby-version }}
455
+ bundler-cache: true
456
+
457
+ - name: Build gem
458
+ shell: bash
459
+ run: gem build tiny_tds.gemspec
460
+
461
+ - name: Install gem and test if TinyTDS loads
462
+ shell: bash
463
+ run: |
464
+ gemVersion=$(<VERSION tr -d '[:space:]')
465
+ gem install "tiny_tds-$gemVersion.gem"
466
+
467
+ - name: Test if TinyTDS loads
468
+ shell: bash
469
+ run: |
470
+ ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 3.0.0
2
+
3
+ * Drop support for Ruby < 2.7
4
+ * Drop support for SQL Server < 2017
5
+ * Drop support for FreeTDS < 1.0
6
+ * No longer provide a 32-bit Windows build
7
+ * Raise error if FreeTDS is unable to send command buffer to the server
8
+ * Use freetds v1.4.23, libiconv v1.17 and OpenSSL v3.4.0 for Windows builds
9
+ * Add `bigdecimal` to dependencies
10
+
1
11
  ## 2.1.7
2
12
  * Add Ruby 3.3 to the cross compile list
3
13
 
data/ISSUE_TEMPLATE.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  * On Windows? If so, do you need devkit for your ruby install?
4
4
  * Using Ubuntu? If so, you may have forgotten to install FreeTDS first.
5
- * Are you using FreeTDS 0.95.80 or later? Check `$ tsql -C` to find out.
5
+ * Are you using FreeTDS 1.0.0 or later? Check `$ tsql -C` to find out.
6
6
  * If not, please update then uninstall the TinyTDS gem and re-install it.
7
7
  * Have you made sure to [enable SQL Server authentication](http://bit.ly/1Kw3set)?
8
8
  * Doing work with threads and the raw client? Use the ConnectionPool gem?
data/README.md CHANGED
@@ -1,14 +1,13 @@
1
1
  # TinyTDS - Simple and fast FreeTDS bindings for Ruby using DB-Library.
2
2
 
3
- * [![CircleCI](https://circleci.com/gh/rails-sqlserver/tiny_tds.svg?style=svg)](https://app.circleci.com/pipelines/github/rails-sqlserver/tiny_tds) - CircleCi
4
3
  * [![Gem Version](https://img.shields.io/gem/v/tiny_tds.svg)](https://rubygems.org/gems/tiny_tds) - Gem Version
5
4
  * [![Gitter chat](https://img.shields.io/badge/%E2%8A%AA%20GITTER%20-JOIN%20CHAT%20%E2%86%92-brightgreen.svg?style=flat)](https://gitter.im/rails-sqlserver/activerecord-sqlserver-adapter) - Community
6
5
 
7
6
  ## About TinyTDS
8
7
 
9
- The TinyTDS gem is meant to serve the extremely common use-case of connecting, querying and iterating over results to Microsoft SQL Server or Sybase databases from Ruby using the FreeTDS's DB-Library API.
8
+ The TinyTDS gem is meant to serve the extremely common use-case of connecting, querying and iterating over results to Microsoft SQL Server from Ruby using the FreeTDS's DB-Library API.
10
9
 
11
- TinyTDS offers automatic casting to Ruby primitives along with proper encoding support. It converts all SQL Server datatypes to native Ruby primitives while supporting :utc or :local time zones for time-like types. To date it is the only Ruby client library that allows client encoding options, defaulting to UTF-8, while connecting to SQL Server. It also properly encodes all string and binary data. The motivation for TinyTDS is to become the de-facto low level connection mode for the SQL Server Adapter for ActiveRecord.
10
+ TinyTDS offers automatic casting to Ruby primitives along with proper encoding support. It converts all SQL Server datatypes to native Ruby primitives while supporting :utc or :local time zones for time-like types. To date it is the only Ruby client library that allows client encoding options, defaulting to UTF-8, while connecting to SQL Server. It also properly encodes all string and binary data.
12
11
 
13
12
  The API is simple and consists of these classes:
14
13
 
@@ -19,14 +18,14 @@ The API is simple and consists of these classes:
19
18
 
20
19
  ## Install
21
20
 
22
- Installing with rubygems should just work. TinyTDS is currently tested on Ruby version 2.0.0 and upward.
21
+ Installing with rubygems should just work. TinyTDS is currently tested on Ruby version 2.7.0 and upward.
23
22
 
24
23
  ```
25
24
  $ gem install tiny_tds
26
25
  ```
27
26
 
28
27
  If you use Windows, we pre-compile TinyTDS with static versions of FreeTDS and supporting libraries.
29
- If you're using RubyInstaller the binary gem will require that devkit is installed and in your path to operate properly.
28
+ If you're using RubyInstaller, the binary gem will require that devkit is installed and in your path to operate properly.
30
29
 
31
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.
32
31
 
@@ -35,10 +34,10 @@ $ apt-get install wget
35
34
  $ apt-get install build-essential
36
35
  $ apt-get install libc6-dev
37
36
 
38
- $ wget http://www.freetds.org/files/stable/freetds-1.1.24.tar.gz
39
- $ tar -xzf freetds-1.1.24.tar.gz
40
- $ cd freetds-1.1.24
41
- $ ./configure --prefix=/usr/local --with-tdsver=7.3
37
+ $ wget http://www.freetds.org/files/stable/freetds-1.4.23.tar.gz
38
+ $ tar -xzf freetds-1.4.23.tar.gz
39
+ $ cd freetds-1.4.23
40
+ $ ./configure --prefix=/usr/local --with-tdsver=7.4
42
41
  $ make
43
42
  $ make install
44
43
  ```
@@ -53,26 +52,22 @@ Please read the MiniPortile and/or Windows sections at the end of this file for
53
52
 
54
53
  ## Getting Started
55
54
 
56
- Optionally, Microsoft has done a great job writing some articles on how to get started with SQL Server and Ruby using TinyTDS. Please checkout one of the following posts that match your platform.
57
-
58
- * [SQL Server on a Mac](https://www.microsoft.com/en-us/sql-server/developer-get-started/ruby/mac)
59
- * [SQL Server on RHEL](https://www.microsoft.com/en-us/sql-server/developer-get-started/ruby/rhel)
60
- * [SQL Server on Ubuntu](https://www.microsoft.com/en-us/sql-server/developer-get-started/ruby/ubuntu)
55
+ 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.
61
56
 
62
57
 
63
58
  ## FreeTDS Compatibility & Configuration
64
59
 
65
- TinyTDS is developed against FreeTDS 0.95, 0.99, and 1.0 current. Our default and recommended is 1.0. We also test with SQL Server 2008, 2014, and Azure. However, usage of TinyTDS with SQL Server 2000 or 2005 should be just fine. Below are a few QA style notes about installing FreeTDS.
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.
66
61
 
67
- **NOTE:** Windows users of our pre-compiled native gems need not worry about installing FreeTDS and its dependencies.
62
+ > [!IMPORTANT]
63
+ >
64
+ > Windows users of our pre-compiled native gems need not worry about installing FreeTDS and its dependencies.
68
65
 
69
66
  * **Do I need to install FreeTDS?** Yes! Somehow, someway, you are going to need FreeTDS for TinyTDS to compile against.
70
67
 
71
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.
72
69
 
73
- * **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.1.
74
-
75
- * **But I want to use TDS version 7.2 for SQL Server 2005 and up!** TinyTDS uses TDS version 7.1 (previously named 8.0) and fully supports all the data types supported by FreeTDS, this includes `varchar(max)` and `nvarchar(max)`. Technically compiling and using TDS version 7.2 with FreeTDS is not supported. But this does not mean those data types will not work. I know, it's confusing If you want to learn more, read this thread. http://lists.ibiblio.org/pipermail/freetds/2011q3/027306.html
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.
76
71
 
77
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!
78
73
 
@@ -81,7 +76,7 @@ TinyTDS is developed against FreeTDS 0.95, 0.99, and 1.0 current. Our default an
81
76
 
82
77
  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.
83
78
 
84
- Below is a list of the data types we support when using the 7.3 TDS protocol version. Using a lower protocol version will result in these types being returned as strings.
79
+ Below is a list of the data types we support when using the 7.4 TDS protocol version. Using a lower protocol version will result in these types being returned as strings.
85
80
 
86
81
  * [date]
87
82
  * [datetime2]
@@ -108,7 +103,7 @@ Creating a new client takes a hash of options. For valid iconv encoding options,
108
103
  * :appname - Short string seen in SQL Servers process/activity window.
109
104
  * :tds_version - TDS version. Defaults to "7.3".
110
105
  * :login_timeout - Seconds to wait for login. Default to 60 seconds.
111
- * :timeout - Seconds to wait for a response to a SQL command. Default 5 seconds. Prior to 1.0rc5, FreeTDS was unable to set the timeout on a per-client basis, permitting only a global timeout value. This means that if you're using an older version, the timeout values for all clients will be overwritten each time you instantiate a new `TinyTds::Client` object. If you are using 1.0rc5 or later, all clients will have an independent timeout setting as you'd expect. Timeouts caused by network failure will raise a timeout error 1 second after the configured timeout limit is hit (see [#481](https://github.com/rails-sqlserver/tiny_tds/pull/481) for details).
106
+ * :timeout - Seconds to wait for a response to a SQL command. Default 5 seconds. Timeouts caused by network failure will raise a timeout error 1 second after the configured timeout limit is hit (see [#481](https://github.com/rails-sqlserver/tiny_tds/pull/481) for details).
112
107
  * :encoding - Any valid iconv value like CP1251 or ISO-8859-1. Default UTF-8.
113
108
  * :azure - Pass true to signal that you are connecting to azure.
114
109
  * :contained - Pass true to signal that you are connecting with a contained database user.
@@ -390,15 +385,7 @@ Please read our [thread_test.rb](https://github.com/rails-sqlserver/tiny_tds/blo
390
385
 
391
386
  ## Emoji Support 😍
392
387
 
393
- This is possible using FreeTDS version 0.95 or higher. You must use the `use_utf16` login option or add the following config to your `freetds.conf` in either the global section or a specfic dataserver. If you are on Windows, the default location for your conf file will be in `C:\Sites`.
394
-
395
- ```ini
396
- [global]
397
- use utf-16 = true
398
- ```
399
-
400
- The default is true and since FreeTDS v1.0 would do this as well.
401
-
388
+ 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.
402
389
 
403
390
  ## Compiling Gems for Windows
404
391
 
@@ -427,27 +414,21 @@ After that, the quickest way to get setup for development is to use [Docker](htt
427
414
  $ docker-compose up -d
428
415
  ```
429
416
 
430
- This will download our SQL Server for Linux Docker image based from [microsoft/mssql-server-linux/](https://hub.docker.com/r/microsoft/mssql-server-linux/). Our image already has the `[tinytdstest]` DB and `tinytds` users created. This will also download a [toxiproxy](https://github.com/shopify/toxiproxy) Docker image which we can use to simulate network failures for tests. Basically, it does the following.
417
+ This will download the official SQL Server for Linux Docker image from [Microsoft](https://hub.docker.com/r/microsoft/mssql-server-linux/). This will also download a [toxiproxy](https://github.com/shopify/toxiproxy) Docker image which we can use to simulate network failures for tests. Basically, it does the following:
431
418
 
432
419
  ```shell
433
420
  $ docker network create main-network
434
- $ docker pull metaskills/mssql-server-linux-tinytds
435
- $ docker run -p 1433:1433 -d --name sqlserver --network main-network metaskills/mssql-server-linux-tinytds
421
+ $ docker pull mcr.microsoft.com/mssql/server:2017-latest
422
+ $ docker run -p 1433:1433 -d --name sqlserver --network main-network mcr.microsoft.com/mssql/server:2017-latest
436
423
  $ docker pull shopify/toxiproxy
437
424
  $ docker run -p 8474:8474 -p 1234:1234 -d --name toxiproxy --network main-network shopify/toxiproxy
438
425
  ```
439
426
 
440
- If you are using your own database. Make sure to run these SQL commands as SA to get the test database and user installed.
427
+ Make sure to run these SQL scripts as SA to get the test database and user installed. If needed, install [sqlcmd as described by Microsoft for your platform](https://learn.microsoft.com/en-us/sql/tools/sqlcmd/sqlcmd-utility?view=sql-server-ver16&tabs=go%2Clinux&pivots=cs1-bash).
441
428
 
442
- ```sql
443
- CREATE DATABASE [tinytdstest];
444
- ```
445
-
446
- ```sql
447
- CREATE LOGIN [tinytds] WITH PASSWORD = '', CHECK_POLICY = OFF, DEFAULT_DATABASE = [tinytdstest];
448
- USE [tinytdstest];
449
- CREATE USER [tinytds] FOR LOGIN [tinytds];
450
- EXEC sp_addrolemember N'db_owner', N'tinytds';
429
+ ```shell
430
+ /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P super01S3cUr3 -i ./test/sql/db-create.sql
431
+ /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P super01S3cUr3 -i ./test/sql/db-login.sql
451
432
  ```
452
433
 
453
434
  From here you can build and run tests against an installed version of FreeTDS.
@@ -461,9 +442,8 @@ Examples us using enviornment variables to customize the test task.
461
442
 
462
443
  ```
463
444
  $ rake TINYTDS_UNIT_DATASERVER=mydbserver
464
- $ rake TINYTDS_UNIT_DATASERVER=mydbserver TINYTDS_SCHEMA=sqlserver_2008
445
+ $ rake TINYTDS_UNIT_DATASERVER=mydbserver TINYTDS_SCHEMA=sqlserver_2017
465
446
  $ rake TINYTDS_UNIT_HOST=mydb.host.net TINYTDS_SCHEMA=sqlserver_azure
466
- $ rake TINYTDS_UNIT_HOST=mydb.host.net TINYTDS_UNIT_PORT=5000 TINYTDS_SCHEMA=sybase_ase
467
447
  ```
468
448
 
469
449
  ## Docker Builds