[Schmitzm-commits] r1821 - trunk/schmitzm-db/src/main/java/de/schmitzm/postgres

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Sat Jan 14 22:38:03 CET 2012


Author: alfonx
Date: 2012-01-14 22:38:02 +0100 (Sat, 14 Jan 2012)
New Revision: 1821

Modified:
   trunk/schmitzm-db/src/main/java/de/schmitzm/postgres/PGUtil.java
Log:


Modified: trunk/schmitzm-db/src/main/java/de/schmitzm/postgres/PGUtil.java
===================================================================
--- trunk/schmitzm-db/src/main/java/de/schmitzm/postgres/PGUtil.java	2012-01-14 21:08:09 UTC (rev 1820)
+++ trunk/schmitzm-db/src/main/java/de/schmitzm/postgres/PGUtil.java	2012-01-14 21:38:02 UTC (rev 1821)
@@ -970,12 +970,18 @@
 
 	/**
 	 * Killt eine SQL-Abfrage mit gegebenenr ProvessID (pid)
-	 * @throws SQLException 
+	 * 
+	 * @throws SQLException
 	 */
 	public static boolean pg_terminate_backend(Connection dbc, Long procId) throws SQLException {
-		String sql = "SELECT pg_terminate_backend("+procId+");";
-		int colsRs = dbc.createStatement().executeUpdate(sql);
-		return colsRs > 0;
+		String sql = "SELECT pg_terminate_backend(" + procId + ");";
+		ResultSet rs = dbc.createStatement().executeQuery(sql);
+		try {
+			rs.next();
+			return rs.getBoolean(1);
+		} finally {
+			rs.close();
+		}
 	}
 
 }



More information about the Schmitzm-commits mailing list