tiny_tds 2.1.3.pre-x64-mingw32 → 2.1.5-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +0 -0
  3. data/.gitattributes +0 -0
  4. data/.gitignore +0 -0
  5. data/.rubocop.yml +0 -0
  6. data/.travis.yml +1 -1
  7. data/CHANGELOG.md +12 -1
  8. data/CODE_OF_CONDUCT.md +0 -0
  9. data/Gemfile +0 -0
  10. data/ISSUE_TEMPLATE.md +0 -0
  11. data/MIT-LICENSE +0 -0
  12. data/README.md +13 -7
  13. data/Rakefile +0 -0
  14. data/VERSION +1 -1
  15. data/appveyor.yml +15 -1
  16. data/docker-compose.yml +22 -0
  17. data/ext/tiny_tds/client.c +90 -44
  18. data/ext/tiny_tds/client.h +5 -3
  19. data/ext/tiny_tds/extconf.rb +0 -0
  20. data/ext/tiny_tds/extconsts.rb +1 -1
  21. data/ext/tiny_tds/result.c +24 -10
  22. data/ext/tiny_tds/result.h +0 -0
  23. data/ext/tiny_tds/tiny_tds_ext.c +0 -0
  24. data/ext/tiny_tds/tiny_tds_ext.h +0 -0
  25. data/lib/tiny_tds.rb +0 -0
  26. data/lib/tiny_tds/bin.rb +0 -0
  27. data/lib/tiny_tds/client.rb +0 -0
  28. data/lib/tiny_tds/error.rb +0 -0
  29. data/lib/tiny_tds/gem.rb +0 -0
  30. data/lib/tiny_tds/result.rb +0 -0
  31. data/lib/tiny_tds/version.rb +0 -0
  32. data/patches/freetds/1.00.27/0001-mingw_missing_inet_pton.diff +0 -0
  33. data/patches/freetds/1.00.27/0002-Don-t-use-MSYS2-file-libws2_32.diff +0 -0
  34. data/patches/libiconv/1.14/1-avoid-gets-error.patch +0 -0
  35. data/tasks/native_gem.rake +0 -0
  36. data/tasks/package.rake +0 -0
  37. data/tasks/ports.rake +0 -0
  38. data/tasks/ports/freetds.rb +0 -0
  39. data/tasks/ports/libiconv.rb +0 -0
  40. data/tasks/ports/openssl.rb +0 -0
  41. data/tasks/ports/recipe.rb +0 -0
  42. data/tasks/test.rake +0 -0
  43. data/test/appveyor/dbsetup.ps1 +0 -0
  44. data/test/appveyor/dbsetup.sql +0 -0
  45. data/test/benchmark/query.rb +0 -0
  46. data/test/benchmark/query_odbc.rb +0 -0
  47. data/test/benchmark/query_tinytds.rb +0 -0
  48. data/test/client_test.rb +99 -54
  49. data/test/gem_test.rb +15 -15
  50. data/test/result_test.rb +83 -42
  51. data/test/schema/sqlserver_2000.sql +0 -0
  52. data/test/schema/sqlserver_2005.sql +0 -0
  53. data/test/schema/sqlserver_2008.sql +0 -0
  54. data/test/schema/sqlserver_2014.sql +0 -0
  55. data/test/schema/sqlserver_2016.sql +0 -0
  56. data/test/schema/sqlserver_azure.sql +0 -0
  57. data/test/schema/sybase_ase.sql +0 -0
  58. data/test/schema_test.rb +12 -12
  59. data/test/test_helper.rb +58 -4
  60. data/test/thread_test.rb +1 -1
  61. data/tiny_tds.gemspec +1 -0
  62. metadata +27 -4
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/test/schema_test.rb CHANGED
@@ -14,7 +14,7 @@ class SchemaTest < TinyTds::TestCase
14
14
  describe 'for shared types' do
15
15
 
16
16
  it 'casts bigint' do
17
- assert_equal -9223372036854775807, find_value(11, :bigint)
17
+ assert_equal (-9223372036854775807), find_value(11, :bigint)
18
18
  assert_equal 9223372036854775806, find_value(12, :bigint)
19
19
  end
20
20
 
@@ -96,7 +96,7 @@ class SchemaTest < TinyTds::TestCase
96
96
  end
97
97
 
98
98
  it 'casts int' do
99
- assert_equal -2147483647, find_value(151, :int)
99
+ assert_equal (-2147483647), find_value(151, :int)
100
100
  assert_equal 2147483646, find_value(152, :int)
101
101
  end
102
102
 
@@ -170,7 +170,7 @@ class SchemaTest < TinyTds::TestCase
170
170
  end
171
171
 
172
172
  it 'casts smallint' do
173
- assert_equal -32767, find_value(241, :smallint)
173
+ assert_equal (-32767), find_value(241, :smallint)
174
174
  assert_equal 32766, find_value(242, :smallint)
175
175
  end
176
176
 
@@ -396,15 +396,15 @@ class SchemaTest < TinyTds::TestCase
396
396
  if @client.tds_73?
397
397
  assertions = lambda {
398
398
  assert_instance_of Time, v
399
- assert_equal 1984, v.year, 'Year'
400
- assert_equal 1, v.month, 'Month'
401
- assert_equal 24, v.day, 'Day'
402
- assert_equal 4, v.hour, 'Hour'
403
- assert_equal 20, v.min, 'Minute'
404
- assert_equal 59, v.sec, 'Second'
405
- assert_equal 123456, v.usec, 'Microseconds'
406
- assert_equal 123456700, v.nsec, 'Nanoseconds'
407
- assert_equal -28800, v.utc_offset, 'Offset'
399
+ assert_equal 1984, v.year, 'Year'
400
+ assert_equal 1, v.month, 'Month'
401
+ assert_equal 24, v.day, 'Day'
402
+ assert_equal 4, v.hour, 'Hour'
403
+ assert_equal 20, v.min, 'Minute'
404
+ assert_equal 59, v.sec, 'Second'
405
+ assert_equal 123456, v.usec, 'Microseconds'
406
+ assert_equal 123456700, v.nsec, 'Nanoseconds'
407
+ assert_equal (-28800), v.utc_offset, 'Offset'
408
408
  }
409
409
  assertions.call
410
410
  v = find_value 84, :datetimeoffset_7, timezone: :local
data/test/test_helper.rb CHANGED
@@ -2,6 +2,7 @@
2
2
  require 'bundler' ; Bundler.require :development, :test
3
3
  require 'tiny_tds'
4
4
  require 'minitest/autorun'
5
+ require 'toxiproxy'
5
6
 
6
7
  TINYTDS_SCHEMAS = ['sqlserver_2000', 'sqlserver_2005', 'sqlserver_2008', 'sqlserver_2014', 'sqlserver_azure', 'sybase_ase'].freeze
7
8
 
@@ -93,7 +94,7 @@ module TinyTds
93
94
  end
94
95
 
95
96
  def assert_client_works(client)
96
- client.execute("SELECT 'client_works' as [client_works]").each.must_equal [{'client_works' => 'client_works'}]
97
+ _(client.execute("SELECT 'client_works' as [client_works]").each).must_equal [{'client_works' => 'client_works'}]
97
98
  end
98
99
 
99
100
  def assert_new_connections_work
@@ -153,6 +154,8 @@ module TinyTds
153
154
  loader.execute(drop_sql).do
154
155
  loader.execute(schema_sql).do
155
156
  loader.execute(sp_sql).do
157
+ loader.execute(sp_error_sql).do
158
+ loader.execute(sp_several_prints_sql).do
156
159
  loader.close
157
160
  true
158
161
  end
@@ -167,7 +170,16 @@ module TinyTds
167
170
  ) DROP TABLE datatypes
168
171
  IF EXISTS(
169
172
  SELECT 1 FROM sysobjects WHERE type = 'P' AND name = 'tinytds_TestReturnCodes'
170
- ) DROP PROCEDURE tinytds_TestReturnCodes|
173
+ ) DROP PROCEDURE tinytds_TestReturnCodes
174
+ IF EXISTS(
175
+ SELECT 1 FROM sysobjects WHERE type = 'P' AND name = 'tinytds_TestPrintWithError'
176
+ ) DROP PROCEDURE tinytds_TestPrintWithError
177
+ IF EXISTS(
178
+ SELECT 1 FROM sysobjects WHERE type = 'P' AND name = 'tinytds_TestPrintWithError'
179
+ ) DROP PROCEDURE tinytds_TestPrintWithError
180
+ IF EXISTS(
181
+ SELECT 1 FROM sysobjects WHERE type = 'P' AND name = 'tinytds_TestSeveralPrints'
182
+ ) DROP PROCEDURE tinytds_TestSeveralPrints|
171
183
  end
172
184
 
173
185
  def drop_sql_microsoft
@@ -181,7 +193,15 @@ module TinyTds
181
193
  IF EXISTS (
182
194
  SELECT name FROM sysobjects
183
195
  WHERE name = 'tinytds_TestReturnCodes' AND type = 'P'
184
- ) DROP PROCEDURE tinytds_TestReturnCodes|
196
+ ) DROP PROCEDURE tinytds_TestReturnCodes
197
+ IF EXISTS (
198
+ SELECT name FROM sysobjects
199
+ WHERE name = 'tinytds_TestPrintWithError' AND type = 'P'
200
+ ) DROP PROCEDURE tinytds_TestPrintWithError
201
+ IF EXISTS (
202
+ SELECT name FROM sysobjects
203
+ WHERE name = 'tinytds_TestSeveralPrints' AND type = 'P'
204
+ ) DROP PROCEDURE tinytds_TestSeveralPrints|
185
205
  end
186
206
 
187
207
  def sp_sql
@@ -191,6 +211,21 @@ module TinyTds
191
211
  RETURN(420) |
192
212
  end
193
213
 
214
+ def sp_error_sql
215
+ %|CREATE PROCEDURE tinytds_TestPrintWithError
216
+ AS
217
+ PRINT 'hello'
218
+ RAISERROR('Error following print', 16, 1)|
219
+ end
220
+
221
+ def sp_several_prints_sql
222
+ %|CREATE PROCEDURE tinytds_TestSeveralPrints
223
+ AS
224
+ PRINT 'hello 1'
225
+ PRINT 'hello 2'
226
+ PRINT 'hello 3'|
227
+ end
228
+
194
229
  def find_value(id, column, query_options={})
195
230
  query_options[:timezone] ||= :utc
196
231
  sql = "SELECT [#{column}] FROM [datatypes] WHERE [id] = #{id}"
@@ -212,6 +247,25 @@ module TinyTds
212
247
  client.execute("ROLLBACK TRANSACTION").do
213
248
  end
214
249
 
250
+ def init_toxiproxy
251
+ return if ENV['APPVEYOR_BUILD_FOLDER'] # only for CI using docker
252
+
253
+ # In order for toxiproxy to work for local docker instances of mssql, the containers must be on the same network
254
+ # and the host used below must match the mssql container name so toxiproxy knows where to proxy to.
255
+ # localhost from the perspective of toxiproxy's container is its own container an *not* the mssql container it needs to proxy to.
256
+ # docker-compose.yml handles this automatically for us. In instances where someone is using their own local mssql container they'll
257
+ # need to set up the networks manually and set TINYTDS_UNIT_HOST to their mssql container name
258
+ # For anything other than localhost just use the environment config
259
+ env_host = ENV['TINYTDS_UNIT_HOST_TEST'] || ENV['TINYTDS_UNIT_HOST'] || 'localhost'
260
+ host = ['localhost', '127.0.0.1', '0.0.0.0'].include?(env_host) ? 'sqlserver' : env_host
261
+ port = ENV['TINYTDS_UNIT_PORT'] || 1433
262
+ Toxiproxy.populate([
263
+ {
264
+ name: "sqlserver_test",
265
+ listen: "0.0.0.0:1234",
266
+ upstream: "#{host}:#{port}"
267
+ }
268
+ ])
269
+ end
215
270
  end
216
271
  end
217
-
data/test/thread_test.rb CHANGED
@@ -49,7 +49,7 @@ class ThreadTest < TinyTds::TestCase
49
49
  begin
50
50
  result = client.execute "select dbname()"
51
51
  result.each { |r| puts r }
52
- rescue Exception => e
52
+ rescue Exception => _e
53
53
  # We are throwing an error on purpose here since 0.6.1 would
54
54
  # segfault on errors thrown in threads
55
55
  end
data/tiny_tds.gemspec CHANGED
@@ -26,4 +26,5 @@ Gem::Specification.new do |s|
26
26
  s.add_development_dependency 'rake-compiler-dock', '~> 1.0'
27
27
  s.add_development_dependency 'minitest', '~> 5.6'
28
28
  s.add_development_dependency 'connection_pool', '~> 2.2'
29
+ s.add_development_dependency 'toxiproxy', '~> 2.0.0'
29
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny_tds
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3.pre
4
+ version: 2.1.5
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Ken Collins
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-04-08 00:00:00.000000000 Z
13
+ date: 2021-05-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mini_portile2
@@ -96,6 +96,20 @@ dependencies:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
98
  version: '2.2'
99
+ - !ruby/object:Gem::Dependency
100
+ name: toxiproxy
101
+ requirement: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - "~>"
104
+ - !ruby/object:Gem::Version
105
+ version: 2.0.0
106
+ type: :development
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - "~>"
111
+ - !ruby/object:Gem::Version
112
+ version: 2.0.0
99
113
  description: TinyTDS - A modern, simple and fast FreeTDS library for Ruby using DB-Library.
100
114
  Developed for the ActiveRecord SQL Server adapter.
101
115
  email:
@@ -123,6 +137,7 @@ files:
123
137
  - appveyor.yml
124
138
  - bin/defncopy-ttds
125
139
  - bin/tsql-ttds
140
+ - docker-compose.yml
126
141
  - exe/.keep
127
142
  - ext/tiny_tds/client.c
128
143
  - ext/tiny_tds/client.h
@@ -159,6 +174,14 @@ files:
159
174
  - ports/x86_64-w64-mingw32/freetds/1.1.24/lib/libct.la
160
175
  - ports/x86_64-w64-mingw32/freetds/1.1.24/lib/libsybdb.dll.a
161
176
  - ports/x86_64-w64-mingw32/freetds/1.1.24/lib/libsybdb.la
177
+ - ports/x86_64-w64-mingw32/libiconv/1.15/bin/iconv.exe
178
+ - ports/x86_64-w64-mingw32/libiconv/1.15/bin/libcharset-1.dll
179
+ - ports/x86_64-w64-mingw32/libiconv/1.15/bin/libiconv-2.dll
180
+ - ports/x86_64-w64-mingw32/libiconv/1.15/lib/charset.alias
181
+ - ports/x86_64-w64-mingw32/libiconv/1.15/lib/libcharset.dll.a
182
+ - ports/x86_64-w64-mingw32/libiconv/1.15/lib/libcharset.la
183
+ - ports/x86_64-w64-mingw32/libiconv/1.15/lib/libiconv.dll.a
184
+ - ports/x86_64-w64-mingw32/libiconv/1.15/lib/libiconv.la
162
185
  - ports/x86_64-w64-mingw32/openssl/1.1.1d/bin/c_rehash
163
186
  - ports/x86_64-w64-mingw32/openssl/1.1.1d/bin/libcrypto-1_1-x64.dll
164
187
  - ports/x86_64-w64-mingw32/openssl/1.1.1d/bin/libssl-1_1-x64.dll
@@ -217,9 +240,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
217
240
  version: 2.8.dev
218
241
  required_rubygems_version: !ruby/object:Gem::Requirement
219
242
  requirements:
220
- - - ">"
243
+ - - ">="
221
244
  - !ruby/object:Gem::Version
222
- version: 1.3.1
245
+ version: '0'
223
246
  requirements: []
224
247
  rubygems_version: 3.1.2
225
248
  signing_key: