tiny_tds 2.1.2-x64-mingw32 → 2.1.5-x64-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +5 -4
- data/CHANGELOG.md +20 -1
- data/README.md +31 -18
- data/VERSION +1 -1
- data/appveyor.yml +28 -7
- data/docker-compose.yml +22 -0
- data/ext/tiny_tds/client.c +90 -44
- data/ext/tiny_tds/client.h +5 -3
- data/ext/tiny_tds/extconf.rb +17 -13
- data/ext/tiny_tds/extconsts.rb +2 -2
- data/ext/tiny_tds/result.c +24 -10
- data/lib/tiny_tds/2.4/tiny_tds.so +0 -0
- data/lib/tiny_tds/2.5/tiny_tds.so +0 -0
- data/lib/tiny_tds/2.6/tiny_tds.so +0 -0
- data/lib/tiny_tds/2.7/tiny_tds.so +0 -0
- data/ports/x86_64-w64-mingw32/freetds/{1.00.27 → 1.1.24}/bin/bsqldb.exe +0 -0
- data/ports/x86_64-w64-mingw32/freetds/{1.00.27 → 1.1.24}/bin/datacopy.exe +0 -0
- data/ports/x86_64-w64-mingw32/freetds/{1.00.27 → 1.1.24}/bin/defncopy.exe +0 -0
- data/ports/x86_64-w64-mingw32/freetds/{1.00.27 → 1.1.24}/bin/freebcp.exe +0 -0
- data/ports/x86_64-w64-mingw32/freetds/1.1.24/bin/libct-4.dll +0 -0
- data/ports/x86_64-w64-mingw32/freetds/1.1.24/bin/libsybdb-5.dll +0 -0
- data/ports/x86_64-w64-mingw32/freetds/{1.00.27 → 1.1.24}/bin/osql +0 -0
- data/ports/x86_64-w64-mingw32/freetds/1.1.24/bin/tdspool.exe +0 -0
- data/ports/x86_64-w64-mingw32/freetds/1.1.24/bin/tsql.exe +0 -0
- data/ports/x86_64-w64-mingw32/freetds/{1.00.27 → 1.1.24}/lib/libct.dll.a +0 -0
- data/ports/x86_64-w64-mingw32/freetds/{1.00.27 → 1.1.24}/lib/libct.la +2 -2
- data/ports/x86_64-w64-mingw32/freetds/{1.00.27 → 1.1.24}/lib/libsybdb.dll.a +0 -0
- data/ports/x86_64-w64-mingw32/freetds/{1.00.27 → 1.1.24}/lib/libsybdb.la +2 -2
- data/ports/x86_64-w64-mingw32/libiconv/1.15/bin/iconv.exe +0 -0
- data/ports/x86_64-w64-mingw32/libiconv/1.15/bin/libcharset-1.dll +0 -0
- data/ports/x86_64-w64-mingw32/libiconv/1.15/bin/libiconv-2.dll +0 -0
- data/ports/x86_64-w64-mingw32/libiconv/1.15/lib/libcharset.dll.a +0 -0
- data/ports/x86_64-w64-mingw32/libiconv/1.15/lib/libcharset.la +2 -2
- data/ports/x86_64-w64-mingw32/libiconv/1.15/lib/libiconv.dll.a +0 -0
- data/ports/x86_64-w64-mingw32/libiconv/1.15/lib/libiconv.la +2 -2
- data/ports/x86_64-w64-mingw32/openssl/{1.1.0e → 1.1.1d}/bin/c_rehash +3 -3
- data/ports/x86_64-w64-mingw32/openssl/1.1.1d/bin/libcrypto-1_1-x64.dll +0 -0
- data/ports/x86_64-w64-mingw32/openssl/1.1.1d/bin/libssl-1_1-x64.dll +0 -0
- data/ports/x86_64-w64-mingw32/openssl/1.1.1d/bin/openssl.exe +0 -0
- data/ports/x86_64-w64-mingw32/openssl/1.1.1d/lib/libcrypto.a +0 -0
- data/ports/x86_64-w64-mingw32/openssl/{1.1.0e → 1.1.1d}/lib/libcrypto.dll.a +0 -0
- data/ports/x86_64-w64-mingw32/openssl/1.1.1d/lib/libssl.a +0 -0
- data/ports/x86_64-w64-mingw32/openssl/{1.1.0e → 1.1.1d}/lib/libssl.dll.a +0 -0
- data/tasks/native_gem.rake +1 -1
- data/tasks/ports/openssl.rb +2 -18
- data/tasks/ports.rake +5 -7
- data/test/client_test.rb +99 -54
- data/test/gem_test.rb +15 -15
- data/test/result_test.rb +83 -42
- data/test/schema_test.rb +12 -12
- data/test/test_helper.rb +58 -4
- data/test/thread_test.rb +1 -1
- data/tiny_tds.gemspec +3 -2
- metadata +47 -36
- data/BACKERS.md +0 -32
- data/lib/tiny_tds/2.0/tiny_tds.so +0 -0
- data/lib/tiny_tds/2.1/tiny_tds.so +0 -0
- data/lib/tiny_tds/2.2/tiny_tds.so +0 -0
- data/lib/tiny_tds/2.3/tiny_tds.so +0 -0
- data/ports/x86_64-w64-mingw32/freetds/1.00.27/bin/libct-4.dll +0 -0
- data/ports/x86_64-w64-mingw32/freetds/1.00.27/bin/libsybdb-5.dll +0 -0
- data/ports/x86_64-w64-mingw32/freetds/1.00.27/bin/tdspool.exe +0 -0
- data/ports/x86_64-w64-mingw32/freetds/1.00.27/bin/tsql.exe +0 -0
- data/ports/x86_64-w64-mingw32/openssl/1.1.0e/bin/libcrypto-1_1-x64.dll +0 -0
- data/ports/x86_64-w64-mingw32/openssl/1.1.0e/bin/libssl-1_1-x64.dll +0 -0
- data/ports/x86_64-w64-mingw32/openssl/1.1.0e/bin/openssl.exe +0 -0
- data/ports/x86_64-w64-mingw32/openssl/1.1.0e/lib/libcrypto.a +0 -0
- data/ports/x86_64-w64-mingw32/openssl/1.1.0e/lib/libssl.a +0 -0
data/test/result_test.rb
CHANGED
@@ -80,7 +80,7 @@ class ResultTest < TinyTds::TestCase
|
|
80
80
|
@client.execute("DELETE FROM [datatypes]").do
|
81
81
|
@client.execute("INSERT INTO [datatypes] ([char_10], [varchar_50]) VALUES ('1', '2')").do
|
82
82
|
result = @client.execute("SELECT TOP (1) [char_10] + 'test' + [varchar_50] AS [test] FROM [datatypes]").each.first['test']
|
83
|
-
result.must_equal "1 test2"
|
83
|
+
_(result).must_equal "1 test2"
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
@@ -135,10 +135,10 @@ class ResultTest < TinyTds::TestCase
|
|
135
135
|
text = 'test affected rows sql'
|
136
136
|
@client.execute("DELETE FROM [datatypes]").do
|
137
137
|
afrows = @client.execute("SELECT @@ROWCOUNT AS AffectedRows").each.first['AffectedRows']
|
138
|
-
['Fixnum', 'Integer'].must_include afrows.class.name
|
138
|
+
_(['Fixnum', 'Integer']).must_include afrows.class.name
|
139
139
|
@client.execute("INSERT INTO [datatypes] ([varchar_50]) VALUES ('#{text}')").do
|
140
140
|
pk1 = @client.execute(@client.identity_sql).each.first['Ident']
|
141
|
-
['Fixnum', 'Integer'].must_include pk1.class.name, 'we it be able to CAST to bigint'
|
141
|
+
_(['Fixnum', 'Integer']).must_include pk1.class.name, 'we it be able to CAST to bigint'
|
142
142
|
@client.execute("UPDATE [datatypes] SET [varchar_50] = NULL WHERE [varchar_50] = '#{text}'").do
|
143
143
|
afrows = @client.execute("SELECT @@ROWCOUNT AS AffectedRows").each.first['AffectedRows']
|
144
144
|
assert_equal 1, afrows
|
@@ -215,34 +215,34 @@ class ResultTest < TinyTds::TestCase
|
|
215
215
|
@client.execute("DELETE FROM [datatypes]").do
|
216
216
|
@client.execute("ROLLBACK TRANSACTION").do
|
217
217
|
count = @client.execute("SELECT COUNT(*) AS [count] FROM [datatypes]").each.first['count']
|
218
|
-
|
218
|
+
_(count).wont_equal 0
|
219
219
|
end
|
220
220
|
|
221
221
|
it 'has a #fields accessor with logic default and valid outcome' do
|
222
222
|
result = @client.execute(@query1)
|
223
|
-
result.fields.must_equal ['one']
|
223
|
+
_(result.fields).must_equal ['one']
|
224
224
|
result.each
|
225
|
-
result.fields.must_equal ['one']
|
225
|
+
_(result.fields).must_equal ['one']
|
226
226
|
end
|
227
227
|
|
228
228
|
it 'always returns an array for fields for all sql' do
|
229
229
|
result = @client.execute("USE [tinytdstest]")
|
230
|
-
result.fields.must_equal []
|
230
|
+
_(result.fields).must_equal []
|
231
231
|
result.do
|
232
|
-
result.fields.must_equal []
|
232
|
+
_(result.fields).must_equal []
|
233
233
|
end
|
234
234
|
|
235
235
|
it 'returns fields even when no results are found' do
|
236
236
|
no_results_query = "SELECT [id], [varchar_50] FROM [datatypes] WHERE [varchar_50] = 'NOTFOUND'"
|
237
237
|
# Fields before each.
|
238
238
|
result = @client.execute(no_results_query)
|
239
|
-
result.fields.must_equal ['id','varchar_50']
|
239
|
+
_(result.fields).must_equal ['id','varchar_50']
|
240
240
|
result.each
|
241
|
-
result.fields.must_equal ['id','varchar_50']
|
241
|
+
_(result.fields).must_equal ['id','varchar_50']
|
242
242
|
# Each then fields
|
243
243
|
result = @client.execute(no_results_query)
|
244
244
|
result.each
|
245
|
-
result.fields.must_equal ['id','varchar_50']
|
245
|
+
_(result.fields).must_equal ['id','varchar_50']
|
246
246
|
end
|
247
247
|
|
248
248
|
it 'allows the result to be canceled before reading' do
|
@@ -254,27 +254,27 @@ class ResultTest < TinyTds::TestCase
|
|
254
254
|
it 'works in tandem with the client when needing to find out if client has sql sent and result is canceled or not' do
|
255
255
|
# Default state.
|
256
256
|
@client = TinyTds::Client.new(connection_options)
|
257
|
-
@client.sqlsent
|
258
|
-
@client.canceled
|
257
|
+
_(@client.sqlsent?).must_equal false
|
258
|
+
_(@client.canceled?).must_equal false
|
259
259
|
# With active result before and after cancel.
|
260
260
|
result = @client.execute(@query1)
|
261
|
-
@client.sqlsent
|
262
|
-
@client.canceled
|
261
|
+
_(@client.sqlsent?).must_equal true
|
262
|
+
_(@client.canceled?).must_equal false
|
263
263
|
result.cancel
|
264
|
-
@client.sqlsent
|
265
|
-
@client.canceled
|
264
|
+
_(@client.sqlsent?).must_equal false
|
265
|
+
_(@client.canceled?).must_equal true
|
266
266
|
assert result.cancel, 'must be safe to call again'
|
267
267
|
# With each and no block.
|
268
268
|
@client.execute(@query1).each
|
269
|
-
@client.sqlsent
|
270
|
-
@client.canceled
|
269
|
+
_(@client.sqlsent?).must_equal false
|
270
|
+
_(@client.canceled?).must_equal false
|
271
271
|
# With each and block.
|
272
272
|
@client.execute(@query1).each do |row|
|
273
|
-
@client.sqlsent
|
274
|
-
@client.canceled
|
273
|
+
_(@client.sqlsent?).must_equal true, 'when iterating over each row in a block'
|
274
|
+
_(@client.canceled?).must_equal false
|
275
275
|
end
|
276
|
-
@client.sqlsent
|
277
|
-
@client.canceled
|
276
|
+
_(@client.sqlsent?).must_equal false
|
277
|
+
_(@client.canceled?).must_equal false
|
278
278
|
# With each and block canceled half way thru.
|
279
279
|
count = @client.execute("SELECT COUNT([id]) AS [count] FROM [datatypes]").each[0]['count']
|
280
280
|
assert count > 10, 'since we want to cancel early for test'
|
@@ -284,25 +284,25 @@ class ResultTest < TinyTds::TestCase
|
|
284
284
|
break if index > 10
|
285
285
|
index += 1
|
286
286
|
end
|
287
|
-
@client.sqlsent
|
288
|
-
@client.canceled
|
287
|
+
_(@client.sqlsent?).must_equal true
|
288
|
+
_(@client.canceled?).must_equal false
|
289
289
|
result.cancel
|
290
|
-
@client.sqlsent
|
291
|
-
@client.canceled
|
290
|
+
_(@client.sqlsent?).must_equal false
|
291
|
+
_(@client.canceled?).must_equal true
|
292
292
|
# With do method.
|
293
293
|
@client.execute(@query1).do
|
294
|
-
@client.sqlsent
|
295
|
-
@client.canceled
|
294
|
+
_(@client.sqlsent?).must_equal false
|
295
|
+
_(@client.canceled?).must_equal true
|
296
296
|
# With insert method.
|
297
297
|
rollback_transaction(@client) do
|
298
298
|
@client.execute("INSERT INTO [datatypes] ([varchar_50]) VALUES ('test')").insert
|
299
|
-
@client.sqlsent
|
300
|
-
@client.canceled
|
299
|
+
_(@client.sqlsent?).must_equal false
|
300
|
+
_(@client.canceled?).must_equal true
|
301
301
|
end
|
302
302
|
# With first
|
303
303
|
@client.execute("SELECT [id] FROM [datatypes]").each(:first => true)
|
304
|
-
@client.sqlsent
|
305
|
-
@client.canceled
|
304
|
+
_(@client.sqlsent?).must_equal false
|
305
|
+
_(@client.canceled?).must_equal true
|
306
306
|
end
|
307
307
|
|
308
308
|
it 'use same string object for hash keys' do
|
@@ -337,7 +337,7 @@ class ResultTest < TinyTds::TestCase
|
|
337
337
|
|
338
338
|
it 'with LOGINPROPERTY function' do
|
339
339
|
v = @client.execute("SELECT LOGINPROPERTY('sa', 'IsLocked') as v").first['v']
|
340
|
-
v.must_equal 0
|
340
|
+
_(v).must_equal 0
|
341
341
|
end
|
342
342
|
|
343
343
|
describe 'with multiple result sets' do
|
@@ -652,6 +652,48 @@ class ResultTest < TinyTds::TestCase
|
|
652
652
|
assert_equal 1, messages.length, 'there should be one message after one print statement'
|
653
653
|
assert_equal msg, m.message, 'message text'
|
654
654
|
end
|
655
|
+
|
656
|
+
it 'must raise an error preceded by a `print` message' do
|
657
|
+
messages.clear
|
658
|
+
action = lambda { @client.execute("EXEC tinytds_TestPrintWithError").do }
|
659
|
+
assert_raise_tinytds_error(action) do |e|
|
660
|
+
assert_equal 'hello', messages.first.message, 'message text'
|
661
|
+
|
662
|
+
assert_equal "Error following print", e.message
|
663
|
+
assert_equal 16, e.severity
|
664
|
+
assert_equal 50000, e.db_error_number
|
665
|
+
end
|
666
|
+
end
|
667
|
+
|
668
|
+
it 'calls the provided message handler for each of a series of `print` messages' do
|
669
|
+
messages.clear
|
670
|
+
@client.execute("EXEC tinytds_TestSeveralPrints").do
|
671
|
+
assert_equal ['hello 1', 'hello 2', 'hello 3'], messages.map { |e| e.message }, 'message list'
|
672
|
+
end
|
673
|
+
|
674
|
+
it 'should flush info messages before raising error in cases of timeout' do
|
675
|
+
@client = new_connection timeout: 1, message_handler: Proc.new { |m| messages << m }
|
676
|
+
action = lambda { @client.execute("print 'hello'; waitfor delay '00:00:02'").do }
|
677
|
+
messages.clear
|
678
|
+
assert_raise_tinytds_error(action) do |e|
|
679
|
+
assert_match %r{timed out}i, e.message, 'ignore if non-english test run'
|
680
|
+
assert_equal 6, e.severity
|
681
|
+
assert_equal 20003, e.db_error_number
|
682
|
+
assert_equal 'hello', messages.first&.message, 'message text'
|
683
|
+
end
|
684
|
+
end
|
685
|
+
|
686
|
+
it 'should print info messages before raising error in cases of timeout' do
|
687
|
+
@client = new_connection timeout: 1, message_handler: Proc.new { |m| messages << m }
|
688
|
+
action = lambda { @client.execute("raiserror('hello', 1, 1) with nowait; waitfor delay '00:00:02'").do }
|
689
|
+
messages.clear
|
690
|
+
assert_raise_tinytds_error(action) do |e|
|
691
|
+
assert_match %r{timed out}i, e.message, 'ignore if non-english test run'
|
692
|
+
assert_equal 6, e.severity
|
693
|
+
assert_equal 20003, e.db_error_number
|
694
|
+
assert_equal 'hello', messages.first&.message, 'message text'
|
695
|
+
end
|
696
|
+
end
|
655
697
|
end
|
656
698
|
|
657
699
|
it 'must not raise an error when severity is 10 or less' do
|
@@ -684,7 +726,7 @@ class ResultTest < TinyTds::TestCase
|
|
684
726
|
end
|
685
727
|
|
686
728
|
it 'throws an error when you execute another query with other results pending' do
|
687
|
-
|
729
|
+
@client.execute(@query1)
|
688
730
|
action = lambda { @client.execute(@query1) }
|
689
731
|
assert_raise_tinytds_error(action) do |e|
|
690
732
|
assert_match %r|with results pending|i, e.message
|
@@ -717,22 +759,22 @@ class ResultTest < TinyTds::TestCase
|
|
717
759
|
it 'must not error at all from reading non-convertable charcters and just use ? marks' do
|
718
760
|
close_client
|
719
761
|
@client = new_connection :encoding => 'ASCII'
|
720
|
-
@client.charset.must_equal 'ASCII'
|
721
|
-
find_value(202, :nvarchar_50).must_equal 'test nvarchar_50 ??'
|
762
|
+
_(@client.charset).must_equal 'ASCII'
|
763
|
+
_(find_value(202, :nvarchar_50)).must_equal 'test nvarchar_50 ??'
|
722
764
|
end
|
723
765
|
|
724
766
|
it 'must error gracefully from writing non-convertable characters' do
|
725
767
|
close_client
|
726
768
|
@client = new_connection :encoding => 'ASCII'
|
727
|
-
@client.charset.must_equal 'ASCII'
|
769
|
+
_(@client.charset).must_equal 'ASCII'
|
728
770
|
rollback_transaction(@client) do
|
729
771
|
text = 'Test ✓'
|
730
772
|
@client.execute("DELETE FROM [datatypes] WHERE [nvarchar_50] IS NOT NULL").do
|
731
773
|
action = lambda { @client.execute("INSERT INTO [datatypes] ([nvarchar_50]) VALUES ('#{text}')").do }
|
732
774
|
assert_raise_tinytds_error(action) do |e|
|
733
|
-
e.message.must_match %r{Unclosed quotation mark}i
|
734
|
-
e.severity.must_equal 15
|
735
|
-
e.db_error_number.must_equal 105
|
775
|
+
_(e.message).must_match %r{Unclosed quotation mark}i
|
776
|
+
_(e.severity).must_equal 15
|
777
|
+
_(e.db_error_number).must_equal 105
|
736
778
|
end
|
737
779
|
assert_followup_query
|
738
780
|
end
|
@@ -770,4 +812,3 @@ class ResultTest < TinyTds::TestCase
|
|
770
812
|
end
|
771
813
|
|
772
814
|
end
|
773
|
-
|
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,
|
400
|
-
assert_equal 1, v.month,
|
401
|
-
assert_equal 24, v.day,
|
402
|
-
assert_equal 4, v.hour,
|
403
|
-
assert_equal 20, v.min,
|
404
|
-
assert_equal 59, v.sec,
|
405
|
-
assert_equal 123456, v.usec,
|
406
|
-
assert_equal 123456700, v.nsec,
|
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 =>
|
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
@@ -21,9 +21,10 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.required_ruby_version = '>= 2.0.0'
|
22
22
|
s.metadata['msys2_mingw_dependencies'] = 'freetds'
|
23
23
|
s.add_development_dependency 'mini_portile2', '~> 2.0'
|
24
|
-
s.add_development_dependency 'rake', '~>
|
24
|
+
s.add_development_dependency 'rake', '~> 13.0'
|
25
25
|
s.add_development_dependency 'rake-compiler', '~> 1.0'
|
26
|
-
s.add_development_dependency 'rake-compiler-dock', '~> 0
|
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.
|
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:
|
13
|
+
date: 2021-05-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: mini_portile2
|
@@ -32,14 +32,14 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: '
|
35
|
+
version: '13.0'
|
36
36
|
type: :development
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
42
|
+
version: '13.0'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: rake-compiler
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,14 +60,14 @@ dependencies:
|
|
60
60
|
requirements:
|
61
61
|
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0
|
63
|
+
version: '1.0'
|
64
64
|
type: :development
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - "~>"
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: 0
|
70
|
+
version: '1.0'
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: minitest
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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:
|
@@ -112,7 +126,6 @@ files:
|
|
112
126
|
- ".gitignore"
|
113
127
|
- ".rubocop.yml"
|
114
128
|
- ".travis.yml"
|
115
|
-
- BACKERS.md
|
116
129
|
- CHANGELOG.md
|
117
130
|
- CODE_OF_CONDUCT.md
|
118
131
|
- Gemfile
|
@@ -124,6 +137,7 @@ files:
|
|
124
137
|
- appveyor.yml
|
125
138
|
- bin/defncopy-ttds
|
126
139
|
- bin/tsql-ttds
|
140
|
+
- docker-compose.yml
|
127
141
|
- exe/.keep
|
128
142
|
- ext/tiny_tds/client.c
|
129
143
|
- ext/tiny_tds/client.h
|
@@ -134,12 +148,10 @@ files:
|
|
134
148
|
- ext/tiny_tds/tiny_tds_ext.c
|
135
149
|
- ext/tiny_tds/tiny_tds_ext.h
|
136
150
|
- lib/tiny_tds.rb
|
137
|
-
- lib/tiny_tds/2.0/tiny_tds.so
|
138
|
-
- lib/tiny_tds/2.1/tiny_tds.so
|
139
|
-
- lib/tiny_tds/2.2/tiny_tds.so
|
140
|
-
- lib/tiny_tds/2.3/tiny_tds.so
|
141
151
|
- lib/tiny_tds/2.4/tiny_tds.so
|
142
152
|
- lib/tiny_tds/2.5/tiny_tds.so
|
153
|
+
- lib/tiny_tds/2.6/tiny_tds.so
|
154
|
+
- lib/tiny_tds/2.7/tiny_tds.so
|
143
155
|
- lib/tiny_tds/bin.rb
|
144
156
|
- lib/tiny_tds/client.rb
|
145
157
|
- lib/tiny_tds/error.rb
|
@@ -149,19 +161,19 @@ files:
|
|
149
161
|
- patches/freetds/1.00.27/0001-mingw_missing_inet_pton.diff
|
150
162
|
- patches/freetds/1.00.27/0002-Don-t-use-MSYS2-file-libws2_32.diff
|
151
163
|
- patches/libiconv/1.14/1-avoid-gets-error.patch
|
152
|
-
- ports/x86_64-w64-mingw32/freetds/1.
|
153
|
-
- ports/x86_64-w64-mingw32/freetds/1.
|
154
|
-
- ports/x86_64-w64-mingw32/freetds/1.
|
155
|
-
- ports/x86_64-w64-mingw32/freetds/1.
|
156
|
-
- ports/x86_64-w64-mingw32/freetds/1.
|
157
|
-
- ports/x86_64-w64-mingw32/freetds/1.
|
158
|
-
- ports/x86_64-w64-mingw32/freetds/1.
|
159
|
-
- ports/x86_64-w64-mingw32/freetds/1.
|
160
|
-
- ports/x86_64-w64-mingw32/freetds/1.
|
161
|
-
- ports/x86_64-w64-mingw32/freetds/1.
|
162
|
-
- ports/x86_64-w64-mingw32/freetds/1.
|
163
|
-
- ports/x86_64-w64-mingw32/freetds/1.
|
164
|
-
- ports/x86_64-w64-mingw32/freetds/1.
|
164
|
+
- ports/x86_64-w64-mingw32/freetds/1.1.24/bin/bsqldb.exe
|
165
|
+
- ports/x86_64-w64-mingw32/freetds/1.1.24/bin/datacopy.exe
|
166
|
+
- ports/x86_64-w64-mingw32/freetds/1.1.24/bin/defncopy.exe
|
167
|
+
- ports/x86_64-w64-mingw32/freetds/1.1.24/bin/freebcp.exe
|
168
|
+
- ports/x86_64-w64-mingw32/freetds/1.1.24/bin/libct-4.dll
|
169
|
+
- ports/x86_64-w64-mingw32/freetds/1.1.24/bin/libsybdb-5.dll
|
170
|
+
- ports/x86_64-w64-mingw32/freetds/1.1.24/bin/osql
|
171
|
+
- ports/x86_64-w64-mingw32/freetds/1.1.24/bin/tdspool.exe
|
172
|
+
- ports/x86_64-w64-mingw32/freetds/1.1.24/bin/tsql.exe
|
173
|
+
- ports/x86_64-w64-mingw32/freetds/1.1.24/lib/libct.dll.a
|
174
|
+
- ports/x86_64-w64-mingw32/freetds/1.1.24/lib/libct.la
|
175
|
+
- ports/x86_64-w64-mingw32/freetds/1.1.24/lib/libsybdb.dll.a
|
176
|
+
- ports/x86_64-w64-mingw32/freetds/1.1.24/lib/libsybdb.la
|
165
177
|
- ports/x86_64-w64-mingw32/libiconv/1.15/bin/iconv.exe
|
166
178
|
- ports/x86_64-w64-mingw32/libiconv/1.15/bin/libcharset-1.dll
|
167
179
|
- ports/x86_64-w64-mingw32/libiconv/1.15/bin/libiconv-2.dll
|
@@ -170,14 +182,14 @@ files:
|
|
170
182
|
- ports/x86_64-w64-mingw32/libiconv/1.15/lib/libcharset.la
|
171
183
|
- ports/x86_64-w64-mingw32/libiconv/1.15/lib/libiconv.dll.a
|
172
184
|
- ports/x86_64-w64-mingw32/libiconv/1.15/lib/libiconv.la
|
173
|
-
- ports/x86_64-w64-mingw32/openssl/1.1.
|
174
|
-
- ports/x86_64-w64-mingw32/openssl/1.1.
|
175
|
-
- ports/x86_64-w64-mingw32/openssl/1.1.
|
176
|
-
- ports/x86_64-w64-mingw32/openssl/1.1.
|
177
|
-
- ports/x86_64-w64-mingw32/openssl/1.1.
|
178
|
-
- ports/x86_64-w64-mingw32/openssl/1.1.
|
179
|
-
- ports/x86_64-w64-mingw32/openssl/1.1.
|
180
|
-
- ports/x86_64-w64-mingw32/openssl/1.1.
|
185
|
+
- ports/x86_64-w64-mingw32/openssl/1.1.1d/bin/c_rehash
|
186
|
+
- ports/x86_64-w64-mingw32/openssl/1.1.1d/bin/libcrypto-1_1-x64.dll
|
187
|
+
- ports/x86_64-w64-mingw32/openssl/1.1.1d/bin/libssl-1_1-x64.dll
|
188
|
+
- ports/x86_64-w64-mingw32/openssl/1.1.1d/bin/openssl.exe
|
189
|
+
- ports/x86_64-w64-mingw32/openssl/1.1.1d/lib/libcrypto.a
|
190
|
+
- ports/x86_64-w64-mingw32/openssl/1.1.1d/lib/libcrypto.dll.a
|
191
|
+
- ports/x86_64-w64-mingw32/openssl/1.1.1d/lib/libssl.a
|
192
|
+
- ports/x86_64-w64-mingw32/openssl/1.1.1d/lib/libssl.dll.a
|
181
193
|
- tasks/native_gem.rake
|
182
194
|
- tasks/package.rake
|
183
195
|
- tasks/ports.rake
|
@@ -222,18 +234,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
222
234
|
requirements:
|
223
235
|
- - ">="
|
224
236
|
- !ruby/object:Gem::Version
|
225
|
-
version: '2.
|
237
|
+
version: '2.4'
|
226
238
|
- - "<"
|
227
239
|
- !ruby/object:Gem::Version
|
228
|
-
version:
|
240
|
+
version: 2.8.dev
|
229
241
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
242
|
requirements:
|
231
243
|
- - ">="
|
232
244
|
- !ruby/object:Gem::Version
|
233
245
|
version: '0'
|
234
246
|
requirements: []
|
235
|
-
|
236
|
-
rubygems_version: 2.7.3
|
247
|
+
rubygems_version: 3.1.2
|
237
248
|
signing_key:
|
238
249
|
specification_version: 4
|
239
250
|
summary: TinyTDS - A modern, simple and fast FreeTDS library for Ruby using DB-Library.
|
data/BACKERS.md
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# Backers
|
2
|
-
|
3
|
-
You can join in supporting TinyTDS and the Rails SQL Server Adapter development by [pledging on Patreon](https://www.patreon.com/metaskills)! Backers in the same pledge level appear in the order of pledge date.
|
4
|
-
|
5
|
-
### $2000
|
6
|
-
|
7
|
-
[It could be you!](https://www.patreon.com/bePatron?c=765225&rid=1611218)
|
8
|
-
|
9
|
-
|
10
|
-
### $500
|
11
|
-
|
12
|
-
[It could be you!](https://www.patreon.com/bePatron?c=765225&rid=1611209)
|
13
|
-
|
14
|
-
|
15
|
-
### $250
|
16
|
-
|
17
|
-
[It could be you!](https://www.patreon.com/bePatron?c=765225&rid=1611199)
|
18
|
-
|
19
|
-
|
20
|
-
### $100
|
21
|
-
|
22
|
-
[It could be you!](https://www.patreon.com/bePatron?c=765225&rid=1611196)
|
23
|
-
|
24
|
-
|
25
|
-
### $50+
|
26
|
-
|
27
|
-
[It could be you!](https://www.patreon.com/bePatron?c=765225&rid=1611186)
|
28
|
-
|
29
|
-
|
30
|
-
### $10+
|
31
|
-
|
32
|
-
[It could be you!](https://www.patreon.com/bePatron?c=765225&rid=1611149)
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|