Permalink
Browse files

Make Database#disconnect not raise an exception when using the unshar…

…ded single connection pool
  • Loading branch information...
1 parent dadc3ca commit 2f94449817cc58b48ef6d6859f98e251ab1fcc24 @jeremyevans committed Apr 30, 2010
Showing with 11 additions and 0 deletions.
  1. +4 −0 CHANGELOG
  2. +1 −0 lib/sequel/connection_pool/single.rb
  3. +6 −0 spec/core/connection_pool_spec.rb
View
4 CHANGELOG
@@ -1,5 +1,9 @@
=== HEAD
+* Make Database#disconnect not raise an exception when using the unsharded single connection pool (jeremyevans)
+
+* Attempt to handle JDBC connection problems in cases where driver auto loading doesn't work (e.g. Tomcat) (elskwid)
+
* Make native MySQL adapter's tinyint to boolean conversion only convert tinyint(1) columns and not larger tinyint columns (roland.swingler) (#294)
* Fix use of limit with distinct on Microsoft SQL Server (jeremyevans) (#297)
View
1 lib/sequel/connection_pool/single.rb
@@ -10,6 +10,7 @@ def size
# Disconnect the connection from the database.
def disconnect(opts=nil, &block)
+ return unless @conn
block ||= @disconnection_proc
block.call(@conn) if block
@conn = nil
View
6 spec/core/connection_pool_spec.rb
@@ -734,6 +734,12 @@ def value
end
shared_examples_for "All connection pools classes" do
+ specify "should not raise an error when disconnecting twice" do
+ c = @class.new({}){123}
+ proc{c.disconnect}.should_not raise_error
+ proc{c.disconnect}.should_not raise_error
+ end
+
specify "should yield a connection created by the initialize block to hold" do
x = nil
@class.new({}){123}.hold{|c| x = c}

0 comments on commit 2f94449

Please sign in to comment.