tiny_tds 0.6.2-x64-mingw32 → 0.6.3.rc2-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.
@@ -1,3 +1,3 @@
1
1
  module TinyTds
2
- VERSION = '0.6.2'
3
- end
2
+ VERSION = '0.6.3.rc2'
3
+ end
data/test/client_test.rb CHANGED
@@ -2,9 +2,9 @@
2
2
  require 'test_helper'
3
3
 
4
4
  class ClientTest < TinyTds::TestCase
5
-
5
+
6
6
  describe 'With valid credentials' do
7
-
7
+
8
8
  before do
9
9
  @client = new_connection
10
10
  end
@@ -13,7 +13,7 @@ class ClientTest < TinyTds::TestCase
13
13
  assert !@client.closed?
14
14
  assert @client.active?
15
15
  end
16
-
16
+
17
17
  it 'allows client connection to be closed' do
18
18
  assert @client.close
19
19
  assert @client.closed?
@@ -23,7 +23,7 @@ class ClientTest < TinyTds::TestCase
23
23
  assert_match %r{closed connection}i, e.message, 'ignore if non-english test run'
24
24
  end
25
25
  end
26
-
26
+
27
27
  it 'has getters for the tds version information (brittle since conf takes precedence)' do
28
28
  if sybase_ase?
29
29
  assert_equal 7, @client.tds_version
@@ -33,16 +33,16 @@ class ClientTest < TinyTds::TestCase
33
33
  assert_equal 'DBTDS_7_1/DBTDS_8_0 - Microsoft SQL Server 2000', @client.tds_version_info
34
34
  end
35
35
  end
36
-
36
+
37
37
  it 'uses UTF-8 client charset/encoding by default' do
38
38
  assert_equal 'UTF-8', @client.charset
39
39
  assert_equal Encoding.find('UTF-8'), @client.encoding
40
40
  end
41
-
41
+
42
42
  it 'has a #escape method used for quote strings' do
43
43
  assert_equal "''hello''", @client.escape("'hello'")
44
44
  end
45
-
45
+
46
46
  it 'allows valid iconv character set' do
47
47
  ['CP850', 'CP1252', 'ISO-8859-1'].each do |encoding|
48
48
  client = new_connection(:encoding => encoding)
@@ -50,23 +50,23 @@ class ClientTest < TinyTds::TestCase
50
50
  assert_equal Encoding.find(encoding), client.encoding
51
51
  end
52
52
  end
53
-
53
+
54
54
  it 'must be able to use :host/:port connection' do
55
55
  client = new_connection :dataserver => nil, :host => ENV['TINYTDS_UNIT_HOST'], :port => ENV['TINYTDS_UNIT_PORT'] || 1433
56
56
  end unless sqlserver_azure?
57
-
57
+
58
58
  end
59
-
59
+
60
60
  describe 'With in-valid options' do
61
-
61
+
62
62
  it 'raises an argument error when no :host given and :dataserver is blank' do
63
63
  assert_raises(ArgumentError) { new_connection :dataserver => nil, :host => nil }
64
64
  end
65
-
65
+
66
66
  it 'raises an argument error when no :username is supplied' do
67
67
  assert_raises(ArgumentError) { TinyTds::Client.new :username => nil }
68
68
  end
69
-
69
+
70
70
  it 'raises TinyTds exception with undefined :dataserver' do
71
71
  options = connection_options :login_timeout => 1, :dataserver => '127.0.0.2'
72
72
  action = lambda { new_connection(options) }
@@ -77,7 +77,7 @@ class ClientTest < TinyTds::TestCase
77
77
  end
78
78
  assert_new_connections_work
79
79
  end
80
-
80
+
81
81
  it 'raises TinyTds exception with long query past :timeout option' do
82
82
  client = new_connection :timeout => 1
83
83
  action = lambda { client.execute("WaitFor Delay '00:00:02'").do }
@@ -89,14 +89,14 @@ class ClientTest < TinyTds::TestCase
89
89
  assert_client_works(client)
90
90
  assert_new_connections_work
91
91
  end
92
-
92
+
93
93
  it 'must not timeout per sql batch when not under transaction' do
94
94
  client = new_connection :timeout => 2
95
95
  client.execute("WaitFor Delay '00:00:01'").do
96
96
  client.execute("WaitFor Delay '00:00:01'").do
97
97
  client.execute("WaitFor Delay '00:00:01'").do
98
98
  end
99
-
99
+
100
100
  it 'must not timeout per sql batch when under transaction' do
101
101
  client = new_connection :timeout => 2
102
102
  begin
@@ -108,7 +108,7 @@ class ClientTest < TinyTds::TestCase
108
108
  client.execute("COMMIT TRANSACTION").do
109
109
  end
110
110
  end
111
-
111
+
112
112
  it 'must run this test to prove we account for dropped connections' do
113
113
  skip
114
114
  begin
@@ -135,7 +135,7 @@ class ClientTest < TinyTds::TestCase
135
135
  assert_new_connections_work
136
136
  end
137
137
  end
138
-
138
+
139
139
  it 'raises TinyTds exception with wrong :username' do
140
140
  options = connection_options :username => 'willnotwork'
141
141
  action = lambda { new_connection(options) }
@@ -150,7 +150,7 @@ class ClientTest < TinyTds::TestCase
150
150
  end
151
151
  assert_new_connections_work
152
152
  end
153
-
153
+
154
154
  it 'fails miserably with unknown encoding option' do
155
155
  options = connection_options :encoding => 'ISO-WTF'
156
156
  action = lambda { new_connection(options) }
@@ -161,10 +161,10 @@ class ClientTest < TinyTds::TestCase
161
161
  end
162
162
  assert_new_connections_work
163
163
  end unless sybase_ase?
164
-
164
+
165
165
  end
166
-
167
-
168
-
166
+
167
+
168
+
169
169
  end
170
170
 
data/test/result_test.rb CHANGED
@@ -2,24 +2,24 @@
2
2
  require 'test_helper'
3
3
 
4
4
  class ResultTest < TinyTds::TestCase
5
-
5
+
6
6
  describe 'Basic query and result' do
7
-
7
+
8
8
  before do
9
9
  @@current_schema_loaded ||= load_current_schema
10
10
  @client = new_connection
11
11
  @query1 = 'SELECT 1 AS [one]'
12
12
  end
13
-
13
+
14
14
  it 'has included Enumerable' do
15
15
  assert TinyTds::Result.ancestors.include?(Enumerable)
16
16
  end
17
-
17
+
18
18
  it 'responds to #each' do
19
19
  result = @client.execute(@query1)
20
20
  assert result.respond_to?(:each)
21
21
  end
22
-
22
+
23
23
  it 'returns all results for #each with no block' do
24
24
  result = @client.execute(@query1)
25
25
  data = result.each
@@ -28,7 +28,7 @@ class ResultTest < TinyTds::TestCase
28
28
  assert_equal 1, data.size
29
29
  assert_instance_of Hash, row, 'hash is the default query option'
30
30
  end
31
-
31
+
32
32
  it 'returns all results for #each with a block yielding a row at a time' do
33
33
  result = @client.execute(@query1)
34
34
  data = result.each do |row|
@@ -36,7 +36,7 @@ class ResultTest < TinyTds::TestCase
36
36
  end
37
37
  assert_instance_of Array, data
38
38
  end
39
-
39
+
40
40
  it 'allows successive calls to each returning the same data' do
41
41
  result = @client.execute(@query1)
42
42
  data = result.each
@@ -44,7 +44,7 @@ class ResultTest < TinyTds::TestCase
44
44
  assert_equal data.object_id, result.each.object_id
45
45
  assert_equal data.first.object_id, result.each.first.object_id
46
46
  end
47
-
47
+
48
48
  it 'returns hashes with string keys' do
49
49
  result = @client.execute(@query1)
50
50
  row = result.each(:as => :hash, :symbolize_keys => false).first
@@ -52,7 +52,7 @@ class ResultTest < TinyTds::TestCase
52
52
  assert_equal ['one'], row.keys
53
53
  assert_equal ['one'], result.fields
54
54
  end
55
-
55
+
56
56
  it 'returns hashes with symbol keys' do
57
57
  result = @client.execute(@query1)
58
58
  row = result.each(:as => :hash, :symbolize_keys => true).first
@@ -60,14 +60,14 @@ class ResultTest < TinyTds::TestCase
60
60
  assert_equal [:one], row.keys
61
61
  assert_equal [:one], result.fields
62
62
  end
63
-
63
+
64
64
  it 'returns arrays with string fields' do
65
65
  result = @client.execute(@query1)
66
66
  row = result.each(:as => :array, :symbolize_keys => false).first
67
67
  assert_instance_of Array, row
68
68
  assert_equal ['one'], result.fields
69
69
  end
70
-
70
+
71
71
  it 'returns arrays with symbol fields' do
72
72
  result = @client.execute(@query1)
73
73
  row = result.each(:as => :array, :symbolize_keys => true).first
@@ -83,7 +83,7 @@ class ResultTest < TinyTds::TestCase
83
83
  result.must_equal "1 test2"
84
84
  end
85
85
  end
86
-
86
+
87
87
  it 'must be able to turn :cache_rows option off' do
88
88
  result = @client.execute(@query1)
89
89
  local = []
@@ -94,7 +94,7 @@ class ResultTest < TinyTds::TestCase
94
94
  assert_equal [], result.each, 'should not have been cached'
95
95
  assert_equal ['one'], result.fields, 'should still cache field names'
96
96
  end
97
-
97
+
98
98
  it 'must be able to get the first result row only' do
99
99
  load_current_schema
100
100
  big_query = "SELECT [id] FROM [datatypes]"
@@ -103,12 +103,12 @@ class ResultTest < TinyTds::TestCase
103
103
  assert many.size > 1
104
104
  assert one.size == 1
105
105
  end
106
-
106
+
107
107
  it 'copes with no results when using first option' do
108
108
  data = @client.execute("SELECT [id] FROM [datatypes] WHERE [id] = -1").each(:first => true)
109
109
  assert_equal [], data
110
110
  end
111
-
111
+
112
112
  it 'must delete, insert and find data' do
113
113
  rollback_transaction(@client) do
114
114
  text = 'test insert and delete'
@@ -119,7 +119,7 @@ class ResultTest < TinyTds::TestCase
119
119
  assert_equal text, row['varchar_50']
120
120
  end
121
121
  end
122
-
122
+
123
123
  it 'must insert and find unicode data' do
124
124
  rollback_transaction(@client) do
125
125
  text = '✓'
@@ -129,7 +129,7 @@ class ResultTest < TinyTds::TestCase
129
129
  assert_equal text, row['nvarchar_50']
130
130
  end
131
131
  end
132
-
132
+
133
133
  it 'must delete and update with affected rows support and insert with identity support in native sql' do
134
134
  rollback_transaction(@client) do
135
135
  text = 'test affected rows sql'
@@ -144,7 +144,7 @@ class ResultTest < TinyTds::TestCase
144
144
  assert_equal 1, afrows
145
145
  end
146
146
  end
147
-
147
+
148
148
  it 'has a #do method that cancels result rows and returns affected rows natively' do
149
149
  rollback_transaction(@client) do
150
150
  text = 'test affected rows native'
@@ -157,7 +157,7 @@ class ResultTest < TinyTds::TestCase
157
157
  assert_equal 1, updated_rows, 'should have updated row for one above' unless sqlserver_2000? # Will report -1
158
158
  end
159
159
  end
160
-
160
+
161
161
  it 'allows native affected rows using #do to work under transaction' do
162
162
  rollback_transaction(@client) do
163
163
  text = 'test affected rows native in transaction'
@@ -169,7 +169,7 @@ class ResultTest < TinyTds::TestCase
169
169
  assert_equal 1, updated_rows, 'should have updated row for one above' unless sqlserver_2000? # Will report -1
170
170
  end
171
171
  end
172
-
172
+
173
173
  it 'has an #insert method that cancels result rows and returns IDENTITY natively' do
174
174
  rollback_transaction(@client) do
175
175
  text = 'test scope identity rows native'
@@ -180,11 +180,11 @@ class ResultTest < TinyTds::TestCase
180
180
  assert_equal sql_identity+1, native_identity
181
181
  end
182
182
  end
183
-
183
+
184
184
  it 'returns bigint for #insert when needed' do
185
185
  return if sqlserver_azure? # We can not alter clustered index like this test does.
186
- return if sybase_ase? # On Sybase, sp_helpindex cannot be used inside a transaction since it does a
187
- # 'CREATE TABLE' command is not allowed within a multi-statement transaction
186
+ return if sybase_ase? # On Sybase, sp_helpindex cannot be used inside a transaction since it does a
187
+ # 'CREATE TABLE' command is not allowed within a multi-statement transaction
188
188
  # and and sp_helpindex creates a temporary table #spindtab.
189
189
  rollback_transaction(@client) do
190
190
  seed = 9223372036854775805
@@ -208,7 +208,7 @@ class ResultTest < TinyTds::TestCase
208
208
  assert_equal 0, count
209
209
  end
210
210
  end
211
-
211
+
212
212
  it 'must be able to begin/rollback transactions with raw sql' do
213
213
  load_current_schema
214
214
  @client.execute("BEGIN TRANSACTION").do
@@ -217,21 +217,21 @@ class ResultTest < TinyTds::TestCase
217
217
  count = @client.execute("SELECT COUNT(*) AS [count] FROM [datatypes]").each.first['count']
218
218
  0.wont_equal count
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
223
  result.fields.must_equal ['one']
224
224
  result.each
225
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
230
  result.fields.must_equal []
231
231
  result.do
232
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.
@@ -244,19 +244,19 @@ class ResultTest < TinyTds::TestCase
244
244
  result.each
245
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
249
249
  result = @client.execute(@query1)
250
250
  result.cancel
251
251
  @client.execute(@query1).each
252
252
  end
253
-
253
+
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
257
  @client.sqlsent?.must_equal false
258
258
  @client.canceled?.must_equal false
259
- # With active result before and after cancel.
259
+ # With active result before and after cancel.
260
260
  result = @client.execute(@query1)
261
261
  @client.sqlsent?.must_equal true
262
262
  @client.canceled?.must_equal false
@@ -280,7 +280,7 @@ class ResultTest < TinyTds::TestCase
280
280
  assert count > 10, 'since we want to cancel early for test'
281
281
  result = @client.execute("SELECT [id] FROM [datatypes]")
282
282
  index = 0
283
- result.each do |row|
283
+ result.each do |row|
284
284
  break if index > 10
285
285
  index += 1
286
286
  end
@@ -304,12 +304,12 @@ class ResultTest < TinyTds::TestCase
304
304
  @client.sqlsent?.must_equal false
305
305
  @client.canceled?.must_equal true
306
306
  end
307
-
307
+
308
308
  it 'use same string object for hash keys' do
309
309
  data = @client.execute("SELECT [id], [bigint] FROM [datatypes]").each
310
310
  assert_equal data.first.keys.map{ |r| r.object_id }, data.last.keys.map{ |r| r.object_id }
311
311
  end
312
-
312
+
313
313
  it 'has properly encoded column names with symbol keys' do
314
314
  col_name = "öäüß"
315
315
  @client.execute("DROP TABLE [test_encoding]").do rescue nil
@@ -322,7 +322,7 @@ class ResultTest < TinyTds::TestCase
322
322
  assert_instance_of Symbol, row.keys.first
323
323
  assert_equal col_name.to_sym, row.keys.first
324
324
  end unless sqlserver_azure?
325
-
325
+
326
326
  it 'allows #return_code to work with stored procedures and reset per sql batch' do
327
327
  assert_nil @client.return_code
328
328
  result = @client.execute("EXEC tinytds_TestReturnCodes")
@@ -334,13 +334,13 @@ class ResultTest < TinyTds::TestCase
334
334
  assert_nil @client.return_code
335
335
  assert_nil result.return_code
336
336
  end
337
-
337
+
338
338
  describe 'with multiple result sets' do
339
-
339
+
340
340
  before do
341
341
  @empty_select = "SELECT 1 AS [rs1] WHERE 1 = 0"
342
342
  @double_select = "SELECT 1 AS [rs1]
343
- SELECT 2 AS [rs2]"
343
+ SELECT 2 AS [rs2]"
344
344
  @triple_select_1st_empty = "SELECT 1 AS [rs1] WHERE 1 = 0
345
345
  SELECT 2 AS [rs2]
346
346
  SELECT 3 AS [rs3]"
@@ -351,7 +351,7 @@ class ResultTest < TinyTds::TestCase
351
351
  SELECT 2 AS [rs2]
352
352
  SELECT 3 AS [rs3] WHERE 1 = 0"
353
353
  end
354
-
354
+
355
355
  it 'handles a command buffer with double selects' do
356
356
  result = @client.execute(@double_select)
357
357
  result_sets = result.each
@@ -369,14 +369,14 @@ class ResultTest < TinyTds::TestCase
369
369
  assert_equal [['rs1'], ['rs2']], result.fields
370
370
  assert_equal result.each.object_id, result.each.object_id, 'same cached rows'
371
371
  end
372
-
372
+
373
373
  it 'yields each row for each result set' do
374
374
  data = []
375
375
  result_sets = @client.execute(@double_select).each { |row| data << row }
376
376
  assert_equal data.first, result_sets.first[0]
377
377
  assert_equal data.last, result_sets.last[0]
378
378
  end
379
-
379
+
380
380
  it 'works from a stored procedure' do
381
381
  if sqlserver?
382
382
  results1, results2 = @client.execute("EXEC sp_helpconstraint '[datatypes]'").each
@@ -395,23 +395,23 @@ class ResultTest < TinyTds::TestCase
395
395
  end
396
396
 
397
397
  describe 'using :empty_sets TRUE' do
398
-
398
+
399
399
  before do
400
400
  @old_query_option_value = TinyTds::Client.default_query_options[:empty_sets]
401
401
  TinyTds::Client.default_query_options[:empty_sets] = true
402
402
  @client = new_connection
403
403
  end
404
-
404
+
405
405
  after do
406
406
  TinyTds::Client.default_query_options[:empty_sets] = @old_query_option_value
407
407
  end
408
-
408
+
409
409
  it 'handles a basic empty result set' do
410
410
  result = @client.execute(@empty_select)
411
411
  assert_equal [], result.each
412
412
  assert_equal ['rs1'], result.fields
413
413
  end
414
-
414
+
415
415
  it 'includes empty result sets by default - using 1st empty buffer' do
416
416
  result = @client.execute(@triple_select_1st_empty)
417
417
  result_sets = result.each
@@ -431,7 +431,7 @@ class ResultTest < TinyTds::TestCase
431
431
  assert_equal [['rs1'], ['rs2'], ['rs3']], result.fields
432
432
  assert_equal result.each.object_id, result.each.object_id, 'same cached rows'
433
433
  end
434
-
434
+
435
435
  it 'includes empty result sets by default - using 2nd empty buffer' do
436
436
  result = @client.execute(@triple_select_2nd_empty)
437
437
  result_sets = result.each
@@ -451,7 +451,7 @@ class ResultTest < TinyTds::TestCase
451
451
  assert_equal [['rs1'], ['rs2'], ['rs3']], result.fields
452
452
  assert_equal result.each.object_id, result.each.object_id, 'same cached rows'
453
453
  end
454
-
454
+
455
455
  it 'includes empty result sets by default - using 3rd empty buffer' do
456
456
  result = @client.execute(@triple_select_3rd_empty)
457
457
  result_sets = result.each
@@ -471,27 +471,27 @@ class ResultTest < TinyTds::TestCase
471
471
  assert_equal [['rs1'], ['rs2'], ['rs3']], result.fields
472
472
  assert_equal result.each.object_id, result.each.object_id, 'same cached rows'
473
473
  end
474
-
474
+
475
475
  end
476
-
476
+
477
477
  describe 'using :empty_sets FALSE' do
478
-
478
+
479
479
  before do
480
480
  @old_query_option_value = TinyTds::Client.default_query_options[:empty_sets]
481
481
  TinyTds::Client.default_query_options[:empty_sets] = false
482
482
  @client = new_connection
483
483
  end
484
-
484
+
485
485
  after do
486
486
  TinyTds::Client.default_query_options[:empty_sets] = @old_query_option_value
487
487
  end
488
-
488
+
489
489
  it 'handles a basic empty result set' do
490
490
  result = @client.execute(@empty_select)
491
491
  assert_equal [], result.each
492
492
  assert_equal ['rs1'], result.fields
493
493
  end
494
-
494
+
495
495
  it 'must not include empty result sets by default - using 1st empty buffer' do
496
496
  result = @client.execute(@triple_select_1st_empty)
497
497
  result_sets = result.each
@@ -509,7 +509,7 @@ class ResultTest < TinyTds::TestCase
509
509
  assert_equal [['rs2'], ['rs3']], result.fields
510
510
  assert_equal result.each.object_id, result.each.object_id, 'same cached rows'
511
511
  end
512
-
512
+
513
513
  it 'must not include empty result sets by default - using 2nd empty buffer' do
514
514
  result = @client.execute(@triple_select_2nd_empty)
515
515
  result_sets = result.each
@@ -527,7 +527,7 @@ class ResultTest < TinyTds::TestCase
527
527
  assert_equal [['rs1'], ['rs3']], result.fields
528
528
  assert_equal result.each.object_id, result.each.object_id, 'same cached rows'
529
529
  end
530
-
530
+
531
531
  it 'must not include empty result sets by default - using 3rd empty buffer' do
532
532
  result = @client.execute(@triple_select_3rd_empty)
533
533
  result_sets = result.each
@@ -545,41 +545,37 @@ class ResultTest < TinyTds::TestCase
545
545
  assert_equal [['rs1'], ['rs2']], result.fields
546
546
  assert_equal result.each.object_id, result.each.object_id, 'same cached rows'
547
547
  end
548
-
548
+
549
549
  end
550
-
550
+
551
551
  end
552
552
 
553
553
  describe 'Complex query with multiple results sets but no actual results' do
554
+
555
+ let(:backup_file) { 'C:\\Users\\Public\\tinytdstest.bak' }
556
+
557
+ after { File.delete(backup_file) if File.exists?(backup_file) }
558
+
554
559
  it 'must not cancel the query until complete' do
555
- @client.execute("
556
- BACKUP DATABASE tinytdstest
557
- TO DISK = 'C:\\Users\\Public\\tinytdstest.bak'
558
- ").do
560
+ @client.execute("BACKUP DATABASE tinytdstest TO DISK = '#{backup_file}'").do
559
561
  end
560
562
 
561
- after do
562
- begin
563
- File.delete 'C:\\Users\\Public\\tinytdstest.bak'
564
- rescue
565
- end
566
- end
567
- end
563
+ end unless sqlserver_azure?
568
564
 
569
565
  describe 'when casting to native ruby values' do
570
-
566
+
571
567
  it 'returns fixnum for 1' do
572
568
  value = @client.execute('SELECT 1 AS [fixnum]').each.first['fixnum']
573
569
  assert_equal 1, value
574
570
  end
575
-
571
+
576
572
  it 'returns nil for NULL' do
577
573
  value = @client.execute('SELECT NULL AS [null]').each.first['null']
578
574
  assert_equal nil, value
579
575
  end
580
-
576
+
581
577
  end
582
-
578
+
583
579
  describe 'with data type' do
584
580
 
585
581
  describe 'char max' do
@@ -601,14 +597,14 @@ class ResultTest < TinyTds::TestCase
601
597
  end unless sqlserver_2000? || sybase_ase?
602
598
 
603
599
  end
604
-
600
+
605
601
  describe 'when shit happens' do
606
-
602
+
607
603
  it 'copes with nil or empty buffer' do
608
- assert_raises(TypeError) { @client.execute(nil) }
604
+ assert_raises(TypeError) { @client.execute(nil) }
609
605
  assert_equal [], @client.execute('').each
610
606
  end
611
-
607
+
612
608
  if sqlserver?
613
609
 
614
610
  it 'must not raise an error when severity is 10 or less' do
@@ -639,7 +635,7 @@ class ResultTest < TinyTds::TestCase
639
635
  end
640
636
 
641
637
  end
642
-
638
+
643
639
  it 'throws an error when you execute another query with other results pending' do
644
640
  result1 = @client.execute(@query1)
645
641
  action = lambda { @client.execute(@query1) }
@@ -649,7 +645,7 @@ class ResultTest < TinyTds::TestCase
649
645
  assert_equal 20019, e.db_error_number
650
646
  end
651
647
  end
652
-
648
+
653
649
  it 'must error gracefully with bad table name' do
654
650
  action = lambda { @client.execute('SELECT * FROM [foobar]').each }
655
651
  assert_raise_tinytds_error(action) do |e|
@@ -660,7 +656,7 @@ class ResultTest < TinyTds::TestCase
660
656
  end
661
657
  assert_followup_query
662
658
  end
663
-
659
+
664
660
  it 'must error gracefully with incorrect syntax' do
665
661
  action = lambda { @client.execute('this will not work').each }
666
662
  assert_raise_tinytds_error(action) do |e|
@@ -706,19 +702,19 @@ class ResultTest < TinyTds::TestCase
706
702
  skip 'FreeTDS 0.91 and higher can only pass this test.'
707
703
  end
708
704
  end unless sybase_ase?
709
-
705
+
710
706
  end
711
707
 
712
708
  end
713
-
714
-
709
+
710
+
715
711
  protected
716
-
712
+
717
713
  def assert_followup_query
718
714
  result = @client.execute(@query1)
719
715
  assert_equal 1, result.each.first['one']
720
716
  end
721
-
717
+
722
718
  def insert_and_select_datatype(datatype)
723
719
  rollback_transaction(@client) do
724
720
  @client.execute("DELETE FROM [datatypes] WHERE [#{datatype}] IS NOT NULL").do
@@ -727,6 +723,6 @@ class ResultTest < TinyTds::TestCase
727
723
  flunk "Large #{datatype} data with a length of #{@big_text.length} did not match found text with length of #{found_text.length}" unless @big_text == found_text
728
724
  end
729
725
  end
730
-
726
+
731
727
  end
732
728