toolhound-ruby 1.0.36 → 1.0.37
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/lib/toolhound-ruby/base.rb +19 -7
- data/lib/toolhound-ruby/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3354b35cb7cf30dfd460b5e126c985827c4a1ae
|
4
|
+
data.tar.gz: cb7a67f6ec21ede8c027bd659a71e6786e331229
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bb22ec51a2b65cdafa49bd17369d6147f1083a96a436b32500fb3973bfb4ed2de92ffcf68ddf78b196560d535510853d3f265ad6b2acc3e9897a10e41012a5d
|
7
|
+
data.tar.gz: b99f003aa73b416fc0b0654c83fe2ff084ef8e6e16c0a7e17e4e8b3d30ba1975ff15ada0ccda7bc9ea0df97b97f130b9bccf2093acafcab89039eb0edf535dbd
|
data/lib/toolhound-ruby/base.rb
CHANGED
@@ -301,29 +301,41 @@ module Toolhound
|
|
301
301
|
|
302
302
|
def query(query, options = {})
|
303
303
|
data = []
|
304
|
+
tries ||= 3
|
304
305
|
begin
|
305
306
|
results = connection.execute(query)
|
306
307
|
opts = {cache_rows: false}.merge(options || {})
|
307
|
-
|
308
308
|
results.each(opts) do |row|
|
309
309
|
data << transform_attributes(row)
|
310
310
|
end
|
311
311
|
data
|
312
|
-
rescue TinyTds::Error
|
313
|
-
|
314
|
-
|
312
|
+
rescue TinyTds::Error => e
|
313
|
+
if e.message =~ /^DBPROCESS/
|
314
|
+
client.reset_connection
|
315
|
+
retry unless (tries -= 1).zero?
|
316
|
+
else
|
317
|
+
# throw the error again
|
318
|
+
raise
|
319
|
+
end
|
320
|
+
|
315
321
|
end
|
316
322
|
ensure
|
317
323
|
finish_statement_handle(results)
|
318
324
|
end
|
319
325
|
|
320
326
|
def update_query(query, options)
|
327
|
+
tries ||= 3
|
321
328
|
begin
|
322
329
|
result = connection.execute(query)
|
323
330
|
result.do
|
324
|
-
rescue TinyTds::Error
|
325
|
-
|
326
|
-
|
331
|
+
rescue TinyTds::Error => e
|
332
|
+
if e.message =~ /^DBPROCESS/
|
333
|
+
client.reset_connection
|
334
|
+
retry unless (tries -= 1).zero?
|
335
|
+
else
|
336
|
+
# throw the error again
|
337
|
+
raise
|
338
|
+
end
|
327
339
|
end
|
328
340
|
ensure
|
329
341
|
finish_statement_handle(result)
|