avoid messing with finalize cycle in Disposable.

ensure statements are closed when connection is closed
This commit is contained in:
Brian J. Cardiff 2016-06-23 22:07:59 -03:00
parent f836bbfccb
commit 34ae9d5775
4 changed files with 39 additions and 5 deletions

View file

@ -40,6 +40,9 @@ module DB
abstract def build_statement(query) : Statement
protected def do_close
@statements_cache.each do |_, stmt|
stmt.close
end
@statements_cache.clear
end
end

View file

@ -17,11 +17,6 @@ module DB
@closed
end
# :nodoc:
def finalize
close
end
# Implementors overrides this method to perform resource cleanup
protected abstract def do_close
end