This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to tag REL9_1_903
in repository libpostgresql-jdbc-java.

commit 82b523e0bd0c69c38a18889369da4329828cf0d3
Author: Dave Cramer <[email protected]>
Date:   Thu Sep 27 09:38:25 2012 -0400

    fixed missing isValid function
---
 org/postgresql/jdbc4/AbstractJdbc4Connection.java | 24 +++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/org/postgresql/jdbc4/AbstractJdbc4Connection.java 
b/org/postgresql/jdbc4/AbstractJdbc4Connection.java
index bb1a309..3bbd083 100644
--- a/org/postgresql/jdbc4/AbstractJdbc4Connection.java
+++ b/org/postgresql/jdbc4/AbstractJdbc4Connection.java
@@ -115,8 +115,28 @@ abstract class AbstractJdbc4Connection extends 
org.postgresql.jdbc3g.AbstractJdb
     public boolean isValid(int timeout) throws SQLException
     {
         checkClosed();
-        throw org.postgresql.Driver.notImplemented(this.getClass(), 
"isValid(int)");
-    }
+       if (timeout < 0) {
+            throw new PSQLException(GT.tr("Invalid timeout ({0}<0).", 
timeout), PSQLState.INVALID_PARAMETER_VALUE);
+        }
+       boolean valid = false;
+           Statement stmt = null;
+       try {
+               if (!isClosed()) {
+               stmt = createStatement();
+               stmt.setQueryTimeout( timeout );
+               stmt.executeQuery( "SELECT 1" );
+               valid = true;
+           }
+       }
+       catch ( SQLException e) {
+               getLogger().log(GT.tr("Validating connection."),e);
+       }
+       finally
+       {
+               if(stmt!=null) try {stmt.close();}catch(Exception ex){}
+       }
+        return valid;    
+}
 
     public void setClientInfo(String name, String value) throws 
SQLClientInfoException
     {

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git

_______________________________________________
pkg-java-commits mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

Reply via email to