lib/jvertica.rb in jvertica-0.1.4 vs lib/jvertica.rb in jvertica-0.1.5
- old
+ new
@@ -109,10 +109,11 @@
def copy query, source = nil, &blk
raise InvalidQuery.new('can use only "copy".') unless %r{\A\s*copy}miu === query
stream = com.vertica.jdbc.VerticaCopyStream.new @connection, query
stream.start
+ thread = nil
begin
if !source.nil?
if source.is_a? IO
stream.addStream org.jruby.util.IOInputStream.new(source)
@@ -129,11 +130,10 @@
end
stream.addStream org.jruby.util.IOInputStream.new(i)
rescue => e
raise e
ensure
- thread.join
end
end
rescue => e
r = stream.finish
@@ -144,9 +144,11 @@
stream.execute
rejects = stream.getRejects
results = stream.finish
rescue => e
raise e
+ ensure
+ thread.join
end
[results, rejects.to_ary]
end