tiny_tds 2.1.4 → 2.1.6

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: b1b3c5584f282850876f00b66df7ffda7c42bcb32ad89f8c74ebe4aa116567d9
4
- data.tar.gz: 3d99f342d5964ee82580ce424fe7ac3be3b6128a247ae8e10bbb9463c57203ce
3
+ metadata.gz: c227164dd1c68b962a974be6437c18912c18daafc5c0041381a063220ecf85a9
4
+ data.tar.gz: 8097ef213542b2f7d034a3c966bbb9a90206fb3524f805c2d37dcd88360599fb
5
5
  SHA512:
6
- metadata.gz: 1eabe9f662404dd47f3e1faac8cc9ffcad7c32b890e73154e7478f0f84f0a7cecf312e21d44fce7e1988db2a8d54ca24eed53109d60489abd04e0f1dfd8cbf63
7
- data.tar.gz: bc7cc00ff8f3d36a066d0d6f2087454a9e2918a0d0439a846b08c34b58eb274b72afa3cc2940a5842a9fd802d6c51e0d8332efa13786fbd45b397d5a954bef98
6
+ metadata.gz: d9d6673bfae26efbb616716a60dfd0f167147544f7bcc3aefc8f73f16a03941d4f1d5773958fe2a3ec6cbdb310202d858c97b25dba2d21a259325accf24ff9d5
7
+ data.tar.gz: 354a38d91976d5cd0d3d33114752cda96502102af8252675ee535a266636c2139c877c67539f050f307b1fcef26449f0f118ceb3d16b82f4ba8857bc2b9d6726
@@ -0,0 +1,407 @@
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 -Pattern '<< 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.3.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
+ - test_linux:
396
+ matrix: *ruby_versions
397
+
398
+ - install_windows:
399
+ matrix:
400
+ parameters:
401
+ ruby_version:
402
+ - '2.5'
403
+ - '2.6'
404
+ - '2.7'
405
+ - '3.0'
406
+ - '3.1'
407
+ - '3.2'
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,4 +1,15 @@
1
- ## (unreleased)
1
+ ## 2.1.6
2
+
3
+ * Add Ruby 3.0, 3.1, and 3.2 to the cross compile list
4
+ * Fix segfault when asking if client was dead after closing it. Fixes #519.
5
+ * Mark `alloc` function as undefined on `TinyTds::Result`. Fixes #515.
6
+ * Fix Gem installation on Windows by adding default freetds msys path. Fixes #522
7
+ * Search for `freetds` in `/opt/homebrew` when installing on Apple Silicon. Fixes #484, #492 and #508.
8
+
9
+ ## 2.1.5
10
+
11
+ * Fix compilation errors for Amazon Linux 1. Fixes #495.
12
+ * Fix segfault for login timeouts
2
13
 
3
14
  ## 2.1.4
4
15
 
@@ -267,4 +278,3 @@ Use both dbsetversion() vs. dbsetlversion. Partially reverts #62.
267
278
 
268
279
 
269
280
  ## 0.1.0 Initial release!
270
-
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,11 +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
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
7
6
 
8
-
9
7
  ## About TinyTDS
10
8
 
11
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.
@@ -409,7 +407,7 @@ For the convenience of Windows users, TinyTDS ships pre-compiled gems for suppor
409
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:
410
408
 
411
409
  ```
412
- $ rake gem:windows
410
+ $ rake gem:native
413
411
  ```
414
412
 
415
413
  The compiled gems will exist in `./pkg` directory.
data/Rakefile CHANGED
@@ -6,19 +6,33 @@ require 'rake/extensiontask'
6
6
  require_relative './ext/tiny_tds/extconsts'
7
7
 
8
8
  SPEC = Gem::Specification.load(File.expand_path('../tiny_tds.gemspec', __FILE__))
9
+
10
+ ruby_cc_ucrt_versions = "3.2.0:3.1.0".freeze
11
+ ruby_cc_mingw32_versions = "3.0.0:2.7.0:2.6.0:2.5.0:2.4.0".freeze
12
+
9
13
  GEM_PLATFORM_HOSTS = {
10
- 'x86-mingw32' => 'i686-w64-mingw32',
11
- 'x64-mingw32' => 'x86_64-w64-mingw32'
14
+ 'x86-mingw32' => {
15
+ host: 'i686-w64-mingw32',
16
+ ruby_versions: ruby_cc_mingw32_versions
17
+ },
18
+ 'x64-mingw32' => {
19
+ host: 'x86_64-w64-mingw32',
20
+ ruby_versions: ruby_cc_mingw32_versions
21
+ },
22
+ 'x64-mingw-ucrt' => {
23
+ host: 'x86_64-w64-mingw32',
24
+ ruby_versions: ruby_cc_ucrt_versions
25
+ },
12
26
  }
13
27
 
14
28
  # Add our project specific files to clean for a rebuild
15
29
  CLEAN.include FileList["{ext,lib}/**/*.{so,#{RbConfig::CONFIG['DLEXT']},o}"],
16
- FileList["exe/*"]
30
+ FileList["exe/*"]
17
31
 
18
32
  # Clobber all our temp files and ports files including .install files
19
33
  # and archives
20
34
  CLOBBER.include FileList["tmp/**/*"],
21
- FileList["ports/**/*"].exclude(%r{^ports/archives})
35
+ FileList["ports/**/*"].exclude(%r{^ports/archives})
22
36
 
23
37
  Dir['tasks/*.rake'].sort.each { |f| load f }
24
38
 
@@ -32,15 +46,11 @@ Rake::ExtensionTask.new('tiny_tds', SPEC) do |ext|
32
46
  # The fat binary gem doesn't depend on the freetds package, since it bundles the library.
33
47
  spec.metadata.delete('msys2_mingw_dependencies')
34
48
 
35
- platform_host_map = GEM_PLATFORM_HOSTS
36
- gemplat = spec.platform.to_s
37
- host = platform_host_map[gemplat]
38
-
39
49
  # We don't need the sources in a fat binary gem
40
50
  spec.files = spec.files.reject { |f| f =~ %r{^ports\/archives/} }
41
51
 
42
52
  # Make sure to include the ports binaries and libraries
43
- spec.files += FileList["ports/#{host}/**/**/{bin,lib}/*"].exclude do |f|
53
+ spec.files += FileList["ports/#{spec.platform.to_s}/**/**/{bin,lib}/*"].exclude do |f|
44
54
  File.directory? f
45
55
  end
46
56
 
@@ -50,4 +60,3 @@ end
50
60
 
51
61
  task build: [:clean, :compile]
52
62
  task default: [:build, :test]
53
-
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.4
1
+ 2.1.6
data/docker-compose.yml CHANGED
@@ -7,16 +7,28 @@ services:
7
7
  mssql:
8
8
  image: metaskills/mssql-server-linux-tinytds:2017-GA
9
9
  container_name: sqlserver
10
+ environment:
11
+ ACCEPT_EULA: Y
12
+ SA_PASSWORD: super01S3cUr3
10
13
  ports:
11
14
  - "1433:1433"
12
- networks:
13
- - main-network
15
+ network_mode: "host"
14
16
 
15
17
  toxiproxy:
16
18
  image: shopify/toxiproxy
17
19
  container_name: toxiproxy
18
- ports:
19
- - "8474:8474"
20
- - "1234:1234"
21
- networks:
22
- - main-network
20
+ command: '/toxiproxy -host=127.0.0.1'
21
+ network_mode: "host"
22
+
23
+ cimgruby:
24
+ image: "cimg/ruby:${RUBY_VERSION:-2.7}"
25
+ container_name: cimg_ruby
26
+ environment:
27
+ TESTOPTS: '-v'
28
+ TINYTDS_UNIT_HOST: '127.0.0.1'
29
+ SA_PASSWORD: super01S3cUr3
30
+ TOXIPROXY_HOST: '127.0.0.1'
31
+ command: tail -F anything
32
+ volumes:
33
+ - .:/home/circleci/project
34
+ network_mode: "host"
@@ -96,13 +96,14 @@ int tinytds_err_handler(DBPROCESS *dbproc, int severity, int dberr, int oserr, c
96
96
  but we don't ever want to automatically retry. Instead have the app
97
97
  decide what to do.
98
98
  */
99
- if (userdata->timing_out) {
99
+ if (userdata && userdata->timing_out) {
100
100
  return INT_CANCEL;
101
101
  }
102
- else {
102
+ // userdata will not be set if hitting timeout during login so check for it first
103
+ if (userdata) {
103
104
  userdata->timing_out = 1;
104
- return_value = INT_TIMEOUT;
105
105
  }
106
+ return_value = INT_TIMEOUT;
106
107
  cancel = 1;
107
108
  break;
108
109
 
@@ -231,6 +232,7 @@ static void rb_tinytds_client_free(void *ptr) {
231
232
  dbloginfree(cwrap->login);
232
233
  if (cwrap->client && !cwrap->closed) {
233
234
  dbclose(cwrap->client);
235
+ cwrap->client = NULL;
234
236
  cwrap->closed = 1;
235
237
  cwrap->userdata->closed = 1;
236
238
  }
@@ -262,6 +264,7 @@ static VALUE rb_tinytds_close(VALUE self) {
262
264
  GET_CLIENT_WRAPPER(self);
263
265
  if (cwrap->client && !cwrap->closed) {
264
266
  dbclose(cwrap->client);
267
+ cwrap->client = NULL;
265
268
  cwrap->closed = 1;
266
269
  cwrap->userdata->closed = 1;
267
270
  }
@@ -21,9 +21,11 @@ end
21
21
  do_help if arg_config('--help')
22
22
 
23
23
  # Make sure to check the ports path for the configured host
24
- host = RbConfig::CONFIG['host']
24
+ architecture = RbConfig::CONFIG['arch']
25
+ architecture = "x86-mingw32" if architecture == "i386-mingw32"
26
+
25
27
  project_dir = File.expand_path("../../..", __FILE__)
26
- freetds_ports_dir = File.join(project_dir, 'ports', host, 'freetds', FREETDS_VERSION)
28
+ freetds_ports_dir = File.join(project_dir, 'ports', architecture, 'freetds', FREETDS_VERSION)
27
29
  freetds_ports_dir = File.expand_path(freetds_ports_dir)
28
30
 
29
31
  # Add all the special path searching from the original tiny_tds build
@@ -33,6 +35,23 @@ DIRS = %w(
33
35
  /usr/local
34
36
  )
35
37
 
38
+ if RbConfig::CONFIG['host_os'] =~ /darwin/i
39
+ # Ruby below 2.7 seems to label the host CPU on Apple Silicon as aarch64
40
+ # 2.7 and above print is as ARM64
41
+ target_host_cpu = Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7') ? 'aarch64' : 'arm64'
42
+
43
+ if RbConfig::CONFIG['host_cpu'] == target_host_cpu
44
+ # Homebrew on Apple Silicon installs into /opt/hombrew
45
+ # https://docs.brew.sh/Installation
46
+ # On Intel Macs, it is /usr/local, so no changes necessary to DIRS
47
+ DIRS.unshift("/opt/homebrew")
48
+ end
49
+ end
50
+
51
+ if ENV["RI_DEVKIT"] && ENV["MINGW_PREFIX"] # RubyInstaller Support
52
+ DIRS.unshift(File.join(ENV["RI_DEVKIT"], ENV["MINGW_PREFIX"]))
53
+ end
54
+
36
55
  # Add the ports directory if it exists for local developer builds
37
56
  DIRS.unshift(freetds_ports_dir) if File.directory?(freetds_ports_dir)
38
57
 
@@ -2,7 +2,7 @@
2
2
  ICONV_VERSION = ENV['TINYTDS_ICONV_VERSION'] || "1.15"
3
3
  ICONV_SOURCE_URI = "http://ftp.gnu.org/pub/gnu/libiconv/libiconv-#{ICONV_VERSION}.tar.gz"
4
4
 
5
- OPENSSL_VERSION = ENV['TINYTDS_OPENSSL_VERSION'] || '1.1.1d'
5
+ OPENSSL_VERSION = ENV['TINYTDS_OPENSSL_VERSION'] || '1.1.1s'
6
6
  OPENSSL_SOURCE_URI = "https://www.openssl.org/source/openssl-#{OPENSSL_VERSION}.tar.gz"
7
7
 
8
8
  FREETDS_VERSION = ENV['TINYTDS_FREETDS_VERSION'] || "1.1.24"