File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
activerecord/lib/active_record/connection_adapters Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -364,9 +364,14 @@ def exec_without_stmt(sql, name = 'SQL') # :nodoc:
364
364
# statement API. For those queries, we need to use this method. :'(
365
365
log ( sql , name ) do
366
366
result = @connection . query ( sql )
367
- cols = result . fetch_fields . map { |field | field . name }
368
- rows = result . to_a
369
- result . free
367
+ cols = [ ]
368
+ rows = [ ]
369
+
370
+ if result
371
+ cols = result . fetch_fields . map { |field | field . name }
372
+ rows = result . to_a
373
+ result . free
374
+ end
370
375
ActiveRecord ::Result . new ( cols , rows )
371
376
end
372
377
end
@@ -400,7 +405,7 @@ def update_sql(sql, name = nil) #:nodoc:
400
405
401
406
def begin_db_transaction #:nodoc:
402
407
exec_without_stmt "BEGIN"
403
- rescue Exception
408
+ rescue Mysql :: Error
404
409
# Transactions aren't supported
405
410
end
406
411
You can’t perform that action at this time.
0 commit comments