tiny_tds 2.1.2 → 2.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2122d9b48df66ded292ff0e42ba758237376d686
4
- data.tar.gz: 2cd078c914b8287bb99db513810e1498707b40ad
2
+ SHA256:
3
+ metadata.gz: 49ea08772f73e8682ea03d9bc715612d3719d395a0f88aa13925ad0d264a7769
4
+ data.tar.gz: 5da3fb070e68241ab548c0afc74dbcbc1b2bc38b58b38a58788c9ca93c0d65b1
5
5
  SHA512:
6
- metadata.gz: 5a70deed6ccd0fd09086c2a16cadb9fa8dc136f3cd6f951a3fbe7a0fc31f5282cc70c08bfe770f6f29970e39cdaa84519dceddc0c624449e9fe45e046d4075c9
7
- data.tar.gz: ef92d35e3e3f7a98818fcf42fc029a4480dfd449dc9da54aa48d180a26435f33d2528fabac0d9cd81d0aaec715ca5180ef470066b75a8e02f11dd0468a5e9f0c
6
+ metadata.gz: 79e1cdec5c9129f5ffb032e17e8c3506ceb9aa1319009d68defe1710c04df56f05c12ca07d8e00d6d145056356e97232f6d6a0e791ee8f2c2d89b87001585b47
7
+ data.tar.gz: b5b9ec330dcbceacef5371376a242b2e629eead159915fe449780fbf6e5f3e99d3ce99103ca75c2df7b3d42d398bfe1f94fd824bb59de98e82bd61b0a84f99ba
@@ -0,0 +1,409 @@
1
+ version: 2.1
2
+
3
+ orbs:
4
+ win: circleci/windows@4.1
5
+ ruby: circleci/ruby@2.0.0
6
+
7
+ commands:
8
+ install-ruby-windows:
9
+ description: "Install Ruby on Windows"
10
+ parameters:
11
+ ruby_version:
12
+ description: 'version tag for the cimg/ruby container'
13
+ type: string
14
+ steps:
15
+ - run:
16
+ name: remove pre-installed ruby
17
+ command: |
18
+ Get-ChildItem -path 'C:\tools\' -filter Ruby* | Remove-Item -Force -Recurse
19
+
20
+ - run:
21
+ name: download and install ruby devkit
22
+ command: |
23
+ $ProgressPreference='SilentlyContinue'
24
+
25
+ $uri = 'https://api.github.com/repos/oneclick/rubyinstaller2/tags?per_page=200'
26
+ $releases = ((Invoke-WebRequest $uri) | ConvertFrom-Json).name | select-string (-join("RubyInstaller-" , "<< parameters.ruby_version >>" ))
27
+ $target_release = (($releases | Sort-Object -Descending)[0] | Out-String).Trim()
28
+ $target_version = $target_release.Substring($target_release.Length - 7)
29
+ $download_uri = "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-$target_version/rubyinstaller-devkit-$target_version-x64.exe"
30
+ echo "Ruby Target Version Found: $target_version"
31
+
32
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
33
+ Invoke-WebRequest -UseBasicParsing -uri $download_uri -OutFile C:\ruby-setup.exe
34
+
35
+ echo "Download finished, starting installation of $target_version"
36
+ C:\ruby-setup.exe /VERYSILENT /NORESTART /ALLUSERS /DIR=C:/Ruby<< parameters.ruby_version >>-x64
37
+
38
+ - run:
39
+ name: ruby diagnostics
40
+ command: |
41
+ $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
42
+ echo "Perl Version:"
43
+ perl --version
44
+ echo "Ruby Version:"
45
+ ruby --version
46
+ echo "Gem Version:"
47
+ gem --version
48
+
49
+ - run:
50
+ name: install bundler
51
+ command: |
52
+ $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
53
+ gem install bundler -v 2.3.26
54
+
55
+ jobs:
56
+ test_linux:
57
+ parameters:
58
+ ruby_version:
59
+ description: 'version tag for the cimg/ruby container'
60
+ type: string
61
+
62
+ machine:
63
+ image: ubuntu-2004:current
64
+
65
+ # be sure to update the ./setup_cimgruby_dev.sh if changes are made to steps below
66
+ steps:
67
+ - checkout
68
+
69
+ - run:
70
+ name: start docker-compose build environment
71
+ command: |
72
+ sudo ./test/bin/setup_volume_permissions.sh
73
+ docker-compose up -d
74
+ echo "Waiting for containers to start..."
75
+ sleep 10
76
+ environment:
77
+ RUBY_VERSION: << parameters.ruby_version >>
78
+
79
+ - run:
80
+ name: install sql prereqs
81
+ command: |
82
+ docker exec cimg_ruby bash -c 'sudo -E ./test/bin/install-mssqltools.sh'
83
+
84
+ - run:
85
+ name: setup tiny_tds test database
86
+ command: |
87
+ docker exec cimg_ruby bash -c './test/bin/setup_tinytds_db.sh'
88
+
89
+ - run:
90
+ name: bundle install gems
91
+ command: |
92
+ docker exec cimg_ruby bash -c 'bundle install'
93
+
94
+ - run:
95
+ name: Write used versions into file
96
+ command: |
97
+ docker exec cimg_ruby bash -c 'bundle exec rake ports:version_file'
98
+
99
+ - restore_cache:
100
+ name: restore ports cache
101
+ keys:
102
+ - ports-<< parameters.ruby_version >>-{{ arch }}-{{ checksum ".ports_versions" }}
103
+ - ports-<< parameters.ruby_version >>-{{ arch }}-
104
+
105
+ - run:
106
+ name: compile ports
107
+ command: |
108
+ docker exec cimg_ruby bash -c 'bundle exec rake ports'
109
+
110
+ - run:
111
+ name: build gem
112
+ command: |
113
+ docker exec cimg_ruby bash -c 'bundle exec rake build'
114
+
115
+ - run:
116
+ name: Fix permissions on ports directory
117
+ command: |
118
+ docker exec cimg_ruby bash -c 'sudo chown -R $(id -u):$(id -g) ports'
119
+
120
+ - run:
121
+ name: test gem
122
+ command: |
123
+ docker exec cimg_ruby bash -c 'bundle exec rake test'
124
+
125
+ - save_cache:
126
+ name: save ports cache
127
+ paths:
128
+ - ./ports
129
+ key: ports-<< parameters.ruby_version >>-{{ arch }}-{{ arch }}-{{ checksum ".ports_versions" }}
130
+
131
+ - store_test_results:
132
+ path: test/reports
133
+
134
+ test_windows:
135
+ parameters:
136
+ ruby_version:
137
+ description: 'version tag for rubydev environment'
138
+ type: string
139
+
140
+ executor:
141
+ name: win/server-2022
142
+ shell: powershell.exe
143
+
144
+ environment:
145
+ RAKEOPT: '-rdevkit'
146
+ TESTOPTS: '-v'
147
+ MAKE: 'make V=1 -j2'
148
+
149
+ steps:
150
+ - install-ruby-windows:
151
+ ruby_version: << parameters.ruby_version >>
152
+
153
+ - checkout
154
+
155
+ - restore_cache:
156
+ name: restore gem cache
157
+ keys:
158
+ - v1-bundle-<< parameters.ruby_version >>-{{ arch }}-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }}
159
+ - v1-bundle-<< parameters.ruby_version >>-{{ arch }}-{{ .Branch }}-
160
+ - v1-bundle-<< parameters.ruby_version >>-{{ arch }}-
161
+
162
+ - run:
163
+ name: bundle install gems
164
+ command: |
165
+ $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
166
+ bundle install --path vendor/bundle
167
+
168
+ - save_cache:
169
+ name: save gem cache
170
+ paths:
171
+ - ./vendor/bundle
172
+ key: v1-bundle-<< parameters.ruby_version >>-{{ arch }}-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }}
173
+
174
+ - attach_workspace:
175
+ at: artifacts
176
+
177
+ - run:
178
+ name: install native gem and restore cross-compiled code from gem
179
+ command: |
180
+ $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
181
+ $rubyArchitecture = (ruby -e 'puts RUBY_PLATFORM').Trim()
182
+ $gemVersion = (Get-Content VERSION).Trim()
183
+
184
+ gem install --local --install-dir=./tmp "artifacts/gems/tiny_tds-$gemVersion-$rubyArchitecture.gem"
185
+
186
+ # Restore precompiled code
187
+ $source = (Resolve-Path ".\tmp\gems\tiny_tds-$gemVersion-$rubyArchitecture\lib\tiny_tds").Path
188
+ $destination = (Resolve-Path ".\lib\tiny_tds").Path
189
+ Get-ChildItem $source -Recurse -Exclude "*.rb" | Copy-Item -Destination {Join-Path $destination $_.FullName.Substring($source.length)}
190
+
191
+ # Restore ports
192
+ Copy-Item -Path ".\tmp\gems\tiny_tds-$gemVersion-$rubyArchitecture\ports" -Destination "." -Recurse
193
+
194
+ - restore_cache:
195
+ name: restore mssql installation file
196
+ key: downloads-{{ checksum "test/bin/install-mssql.ps1" }}
197
+
198
+ - run:
199
+ name: setup mssql
200
+ command: |
201
+ .\test\bin\install-mssql.ps1
202
+
203
+ - save_cache:
204
+ name: save downloads cache
205
+ paths:
206
+ - C:\Downloads
207
+ key: downloads-{{ checksum "test/bin/install-mssql.ps1" }}
208
+
209
+ - run:
210
+ name: install toxiproxy-server
211
+ command: |
212
+ choco install toxiproxy-server --version=2.5.0 -y
213
+ Start-Process toxiproxy-server
214
+
215
+ - run:
216
+ name: test gem
217
+ command: |
218
+ $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
219
+ bundle exec rake test
220
+ environment:
221
+ TOXIPROXY_HOST: "localhost"
222
+
223
+ - store_test_results:
224
+ path: test/reports
225
+
226
+ - run:
227
+ name: Rename gem to a consistent name to store artifact
228
+ command: |
229
+ $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
230
+ $rubyArchitecture = (ruby -e 'puts RUBY_PLATFORM').Trim()
231
+ $gemVersion = (Get-Content VERSION).Trim()
232
+
233
+ New-Item -Path . -Name "tested_artifact" -ItemType "directory"
234
+ Move-Item "artifacts/gems/tiny_tds-$gemVersion-$rubyArchitecture.gem" "tested_artifact"
235
+
236
+ - store_artifacts:
237
+ path: tested_artifact
238
+
239
+ cross_compile_gem:
240
+ parameters:
241
+ platform:
242
+ description: "Platform to compile the gem resources"
243
+ type: string
244
+
245
+ docker:
246
+ - image: "ghcr.io/rake-compiler/rake-compiler-dock-image:1.4.0-mri-<< parameters.platform >>"
247
+
248
+ steps:
249
+ - checkout
250
+
251
+ - run:
252
+ name: bundle install gems
253
+ command: |
254
+ bundle install
255
+
256
+ - run:
257
+ name: Write used versions for ports into file
258
+ command: |
259
+ rake ports:version_file[<< parameters.platform >>]
260
+
261
+ - restore_cache:
262
+ name: restore ports cache
263
+ keys:
264
+ - ports-win-{{ arch }}-{{ checksum ".ports_versions" }}
265
+ - ports-win-{{ arch }}-
266
+
267
+ - run:
268
+ name: Build gem
269
+ command: |
270
+ rake gem:for_platform[<< parameters.platform >>]
271
+
272
+ - run:
273
+ name: Move gems into separate directory before caching
274
+ command: |
275
+ mkdir -p artifacts-<< parameters.platform >>/gems
276
+ mv pkg/*.gem artifacts-<< parameters.platform >>/gems
277
+
278
+ - run:
279
+ name: Remove non-native gem to avoid conflict in workspace
280
+ command: |
281
+ gemVersion=$(cat VERSION | tr -d "[:space:]")
282
+ rm -rf artifacts-<< parameters.platform >>/gems/tiny_tds-$gemVersion.gem
283
+
284
+ - store_artifacts:
285
+ path: artifacts-<< parameters.platform >>/gems
286
+
287
+ - save_cache:
288
+ name: save ports cache
289
+ paths:
290
+ - ./ports
291
+ key: ports-win-{{ arch }}-{{ checksum ".ports_versions" }}
292
+
293
+ - persist_to_workspace:
294
+ name: save gems into workspace
295
+ root: artifacts-<< parameters.platform >>
296
+ paths:
297
+ - gems
298
+
299
+ install_windows:
300
+ parameters:
301
+ ruby_version:
302
+ description: 'version tag for rubydev environment'
303
+ type: string
304
+
305
+ executor:
306
+ name: win/server-2022
307
+ shell: powershell.exe
308
+
309
+ environment:
310
+ RAKEOPT: '-rdevkit'
311
+ TESTOPTS: '-v'
312
+ MAKE: 'make V=1 -j2'
313
+
314
+ steps:
315
+ - install-ruby-windows:
316
+ ruby_version: << parameters.ruby_version >>
317
+
318
+ - run:
319
+ name: Ensure msys2 installation is complete
320
+ command: |
321
+ $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
322
+
323
+ # on older Ruby version, the msys version shipped with RubyInstaller is quite old
324
+ # and RubyInstaller will be unable to install anything because of outdated keys
325
+ # With this those commands, we force to get a new set of keys
326
+ # see https://www.msys2.org/docs/updating/#potential-issues
327
+ ridk exec pacman-key --init
328
+ ridk exec pacman-key --refresh-keys
329
+ ridk install 1 2 3
330
+
331
+ - checkout
332
+
333
+ - restore_cache:
334
+ name: restore gem cache
335
+ keys:
336
+ - v1-bundle-<< parameters.ruby_version >>-{{ arch }}-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }}
337
+ - v1-bundle-<< parameters.ruby_version >>-{{ arch }}-{{ .Branch }}-
338
+ - v1-bundle-<< parameters.ruby_version >>-{{ arch }}-
339
+
340
+ - run:
341
+ name: bundle install gems
342
+ command: |
343
+ $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
344
+ bundle install --path vendor/bundle
345
+
346
+ - save_cache:
347
+ name: save gem cache
348
+ paths:
349
+ - ./vendor/bundle
350
+ key: v1-bundle-<< parameters.ruby_version >>-{{ arch }}-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }}
351
+
352
+ - run:
353
+ name: build gem
354
+ command: |
355
+ $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
356
+ gem build tiny_tds.gemspec
357
+
358
+ - run:
359
+ name: Install gem
360
+ command: |
361
+ $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
362
+ $gemVersion = (Get-Content VERSION).Trim()
363
+ gem install --local "tiny_tds-$gemVersion.gem"
364
+
365
+ - run:
366
+ name: Check if gem loads correctly
367
+ command: |
368
+ $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
369
+ ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
370
+ exit $LASTEXITCODE
371
+
372
+ workflows:
373
+ test_supported_ruby_versions:
374
+ jobs:
375
+ - cross_compile_gem:
376
+ matrix:
377
+ parameters:
378
+ platform:
379
+ - "x86-mingw32"
380
+ - "x64-mingw32"
381
+ - "x64-mingw-ucrt"
382
+ - test_windows:
383
+ requires:
384
+ - cross_compile_gem
385
+ matrix: &ruby_versions
386
+ parameters:
387
+ ruby_version:
388
+ - '2.4'
389
+ - '2.5'
390
+ - '2.6'
391
+ - '2.7'
392
+ - '3.0'
393
+ - '3.1'
394
+ - '3.2'
395
+ - '3.3'
396
+ - test_linux:
397
+ matrix: *ruby_versions
398
+
399
+ - install_windows:
400
+ matrix:
401
+ parameters:
402
+ ruby_version:
403
+ - '2.5'
404
+ - '2.6'
405
+ - '2.7'
406
+ - '3.0'
407
+ - '3.1'
408
+ - '3.2'
409
+ - '3.3'
data/.gitignore CHANGED
@@ -18,3 +18,5 @@ misc
18
18
  /exe/*
19
19
  /ports/*
20
20
  !/ports/patches/
21
+ test/reports
22
+ .ports_versions
data/CHANGELOG.md CHANGED
@@ -1,3 +1,30 @@
1
+ ## 2.1.7
2
+ * Add Ruby 3.3 to the cross compile list
3
+
4
+ ## 2.1.6
5
+
6
+ * Add Ruby 3.0, 3.1, and 3.2 to the cross compile list
7
+ * Fix segfault when asking if client was dead after closing it. Fixes #519.
8
+ * Mark `alloc` function as undefined on `TinyTds::Result`. Fixes #515.
9
+ * Fix Gem installation on Windows by adding default freetds msys path. Fixes #522
10
+ * Search for `freetds` in `/opt/homebrew` when installing on Apple Silicon. Fixes #484, #492 and #508.
11
+
12
+ ## 2.1.5
13
+
14
+ * Fix compilation errors for Amazon Linux 1. Fixes #495.
15
+ * Fix segfault for login timeouts
16
+
17
+ ## 2.1.4
18
+
19
+ * Improve handling of network related timeouts
20
+ * Fix error reporting when preceded by info message
21
+
22
+ ## 2.1.3
23
+
24
+ * Removed old/unused appveyor config
25
+ * Remove old Rubies from CI & cross compile list
26
+ * Add Ruby 2.6 and 2.7 to the cross compile list
27
+
1
28
  ## 2.1.2
2
29
 
3
30
  * Use Kernel.BigDecimal vs BigDecimal.new. Fixes #409.
@@ -207,6 +234,8 @@ Use both dbsetversion() vs. dbsetlversion. Partially reverts #62.
207
234
  state of the client and the need to use Result#cancel to stop processing active results. It is also
208
235
  safe to call Result#cancel over and over again.
209
236
  * Look for the syb headers only.
237
+ * Fix minitest global matchers warnings.
238
+ * Fix test warnings.
210
239
 
211
240
 
212
241
  ## 0.3.2
@@ -252,4 +281,3 @@ Use both dbsetversion() vs. dbsetlversion. Partially reverts #62.
252
281
 
253
282
 
254
283
  ## 0.1.0 Initial release!
255
-
data/Gemfile CHANGED
@@ -1,9 +1,2 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
-
4
- group :development do
5
- end
6
-
7
- group :test do
8
- gem 'minitest'
9
- end
data/README.md CHANGED
@@ -1,16 +1,9 @@
1
1
  # TinyTDS - Simple and fast FreeTDS bindings for Ruby using DB-Library.
2
2
 
3
- * [![TravisCI](https://travis-ci.org/rails-sqlserver/tiny_tds.svg?branch=master)](https://travis-ci.org/rails-sqlserver/tiny_tds) - TravisCI
4
- * [![Build Status](https://ci.appveyor.com/api/projects/status/g2bhhbsdkx0mal55/branch/master?svg=true)](https://ci.appveyor.com/project/rails-sqlserver/tiny-tds/branch/master) - Appveyor
3
+ * [![CircleCI](https://circleci.com/gh/rails-sqlserver/tiny_tds.svg?style=svg)](https://app.circleci.com/pipelines/github/rails-sqlserver/tiny_tds) - CircleCi
5
4
  * [![Gem Version](https://img.shields.io/gem/v/tiny_tds.svg)](https://rubygems.org/gems/tiny_tds) - Gem Version
6
- * [![Dependency Status](https://dependencyci.com/github/rails-sqlserver/tiny_tds/badge)](https://dependencyci.com/github/rails-sqlserver/tiny_tds) - Dependency Status
7
5
  * [![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
8
6
 
9
- ## Supporting TinyTDS/Adapter
10
-
11
- Both TinyTDS and the Rails SQL Server Adapter are MIT-licensed open source projects. Its ongoing development is made possible thanks to the support by these awesome [backers](https://github.com/rails-sqlserver/tiny_tds/blob/master/BACKERS.md). If you'd like to join them, check out our [Patreon Campaign](https://www.patreon.com/metaskills).
12
-
13
-
14
7
  ## About TinyTDS
15
8
 
16
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.
@@ -42,15 +35,15 @@ $ apt-get install wget
42
35
  $ apt-get install build-essential
43
36
  $ apt-get install libc6-dev
44
37
 
45
- $ wget http://www.freetds.org/files/stable/freetds-1.00.21.tar.gz
46
- $ tar -xzf freetds-1.00.21.tar.gz
47
- $ cd freetds-1.00.21
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
48
41
  $ ./configure --prefix=/usr/local --with-tdsver=7.3
49
42
  $ make
50
43
  $ make install
51
44
  ```
52
45
 
53
- If none exist, our native extension will use MiniPortile to install any missing dependencies listed above for your specific platform. These dependencies will be built and linked within the installed TinyTDS gem. Please read the MiniPortile and/or Windows sections at the end of this file for advanced configuration options past the following:
46
+ Please read the MiniPortile and/or Windows sections at the end of this file for advanced configuration options past the following:
54
47
 
55
48
  ```
56
49
  --with-freetds-dir=DIR
@@ -73,11 +66,11 @@ TinyTDS is developed against FreeTDS 0.95, 0.99, and 1.0 current. Our default an
73
66
 
74
67
  **NOTE:** Windows users of our pre-compiled native gems need not worry about installing FreeTDS and its dependencies.
75
68
 
76
- * **Do I need to install FreeTDS?** Yes! Somehow, someway, you are going to need FreeTDS for TinyTDS to compile against. You can avoid installing FreeTDS on your system by using our projects usage of rake-compiler and mini_portile to compile and package a native gem just for you. See the "Using MiniPortile" section below.
69
+ * **Do I need to install FreeTDS?** Yes! Somehow, someway, you are going to need FreeTDS for TinyTDS to compile against.
77
70
 
78
71
  * **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.
79
72
 
80
- * **Do I need to configure `--with-tdsver` equal to anything?** Most likely! Technically you should not have too. 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.
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.
81
74
 
82
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
83
76
 
@@ -115,7 +108,7 @@ Creating a new client takes a hash of options. For valid iconv encoding options,
115
108
  * :appname - Short string seen in SQL Servers process/activity window.
116
109
  * :tds_version - TDS version. Defaults to "7.3".
117
110
  * :login_timeout - Seconds to wait for login. Default to 60 seconds.
118
- * :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.
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).
119
112
  * :encoding - Any valid iconv value like CP1251 or ISO-8859-1. Default UTF-8.
120
113
  * :azure - Pass true to signal that you are connecting to azure.
121
114
  * :contained - Pass true to signal that you are connecting with a contained database user.
@@ -327,9 +320,13 @@ By default row caching is turned on because the SQL Server adapter for ActiveRec
327
320
  TinyTDS takes an opinionated stance on how we handle encoding errors. First, we treat errors differently on reads vs. writes. Our opinion is that if you are reading bad data due to your client's encoding option, you would rather just find `?` marks in your strings vs being blocked with exceptions. This is how things wold work via ODBC or SMS. On the other hand, writes will raise an exception. In this case we raise the SYBEICONVO/2402 error message which has a description of `Error converting characters into server's character set. Some character(s) could not be converted.`. Even though the severity of this message is only a `4` and TinyTDS will automatically strip/ignore unknown characters, we feel you should know that you are inserting bad encodings. In this way, a transaction can be rolled back, etc. Remember, any database write that has bad characters due to the client encoding will still be written to the database, but it is up to you rollback said write if needed. Most ORMs like ActiveRecord handle this scenario just fine.
328
321
 
329
322
 
323
+ ## Timeout Error Handling
324
+
325
+ TinyTDS will raise a `TinyTDS::Error` when a timeout is reached based on the options supplied to the client. Depending on the reason for the timeout, the connection could be dead or alive. When db processing is the cause for the timeout, the connection should still be usable after the error is raised. When network failure is the cause of the timeout, the connection will be dead. If you attempt to execute another command batch on a dead connection you will see a `DBPROCESS is dead or not enabled` error. Therefore, it is recommended to check for a `dead?` connection before trying to execute another command batch.
326
+
330
327
  ## Binstubs
331
328
 
332
- The TinyTDS gem uses binstub wrappers which mirror compiled [FreeTDS Utilities](http://www.freetds.org/userguide/usefreetds.htm) binaries. These native executables are usually installed at the system level when installing FreeTDS. However, when using MiniPortile to install TinyTDS as we do with Windows binaries, these binstubs will find and prefer local gem `exe` directory executables. These are the following binstubs we wrap.
329
+ The TinyTDS gem uses binstub wrappers which mirror compiled [FreeTDS Utilities](https://www.freetds.org/userguide/usefreetds.html) binaries. These native executables are usually installed at the system level when installing FreeTDS. However, when using MiniPortile to install TinyTDS as we do with Windows binaries, these binstubs will find and prefer local gem `exe` directory executables. These are the following binstubs we wrap.
333
330
 
334
331
  * tsql - Used to test connections and debug compile time settings.
335
332
  * defncopy - Used to dump schema structures.
@@ -405,12 +402,12 @@ The default is true and since FreeTDS v1.0 would do this as well.
405
402
 
406
403
  ## Compiling Gems for Windows
407
404
 
408
- For the convenience of Windows users, TinyTDS ships pre-compiled gems for Ruby 2.0, 2.1, 2.2, and 2.3 on Windows. In order to generate these gems, [rake-compiler-dock](https://github.com/rake-compiler/rake-compiler-dock) is used. This project provides a [Docker image](https://registry.hub.docker.com/u/larskanis/rake-compiler-dock/) with rvm, cross-compilers and a number of different target versions of Ruby.
405
+ 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.
409
406
 
410
407
  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:
411
408
 
412
409
  ```
413
- $ rake gem:windows
410
+ $ rake gem:native
414
411
  ```
415
412
 
416
413
  The compiled gems will exist in `./pkg` directory.
@@ -424,17 +421,20 @@ First, clone the repo using the command line or your Git GUI of choice.
424
421
  $ git clone git@github.com:rails-sqlserver/tiny_tds.git
425
422
  ```
426
423
 
427
- After that, the quickest way to get setup for development is to use [Docker](https://www.docker.com/). Assuming you have [downloaded docker](https://www.docker.com/products/docker) for your platform and you have , you can run our test setup script.
424
+ After that, the quickest way to get setup for development is to use [Docker](https://www.docker.com/). Assuming you have [downloaded docker](https://www.docker.com/products/docker) for your platform, you can use [docker-compose](https://docs.docker.com/compose/install/) to run the necessary containers for testing.
428
425
 
429
426
  ```shell
430
- $ ./test/bin/setup.sh
427
+ $ docker-compose up -d
431
428
  ```
432
429
 
433
- 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. Basically, it does the following.
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.
434
431
 
435
432
  ```shell
433
+ $ docker network create main-network
436
434
  $ docker pull metaskills/mssql-server-linux-tinytds
437
- $ docker run -p 1433:1433 -d metaskills/mssql-server-linux-tinytds
435
+ $ docker run -p 1433:1433 -d --name sqlserver --network main-network metaskills/mssql-server-linux-tinytds
436
+ $ docker pull shopify/toxiproxy
437
+ $ docker run -p 8474:8474 -p 1234:1234 -d --name toxiproxy --network main-network shopify/toxiproxy
438
438
  ```
439
439
 
440
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.
@@ -466,6 +466,17 @@ $ rake TINYTDS_UNIT_HOST=mydb.host.net TINYTDS_SCHEMA=sqlserver_azure
466
466
  $ rake TINYTDS_UNIT_HOST=mydb.host.net TINYTDS_UNIT_PORT=5000 TINYTDS_SCHEMA=sybase_ase
467
467
  ```
468
468
 
469
+ ## Docker Builds
470
+
471
+ 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
472
+ into another, lighter, container without build tools you will need to make sure you tell the OS how to find dependencies for TinyTDS.
473
+
474
+ After you have built and installed FreeTDS it will normally place library files in `/usr/local/lib`. When TinyTDS builds native extensions,
475
+ 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.
476
+
477
+ 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
478
+ 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`.
479
+
469
480
  ## Help & Support
470
481
 
471
482
  * Github Source: http://github.com/rails-sqlserver/tiny_tds