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

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Sun Apr 1 23:41:14 CEST 2012


Author: alfonx
Date: 2012-04-01 23:41:14 +0200 (Sun, 01 Apr 2012)
New Revision: 1930

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-04-01 20:22:30 UTC (rev 1929)
+++ trunk/schmitzm-db/src/main/java/de/schmitzm/postgres/PGUtil.java	2012-04-01 21:41:14 UTC (rev 1930)
@@ -145,7 +145,7 @@
 		}
 
 		String sql = "SELECT coord_dimension, srid, type FROM geometry_columns where f_table_catalog='' and f_table_name='"
-				+ tablename + "' and f_geometry_column='" + geoCol+"'";
+				+ tablename + "' and f_geometry_column='" + geoCol + "'";
 		ResultSet rs = null;
 		Statement s = c.createStatement();
 		try {
@@ -867,12 +867,19 @@
 	 * 
 	 * @param minSecondsRunning
 	 *            <code>null</code> oder die zurückgegebenen Anfragen müssen mindestens soviele Sekunden schon laufen.
+	 *            
+	 *            @param filter 0 = kein Filter, 1=Ohne IDLE, 2=Ohne IDLE und ohne 'IDLE in Transaction'
 	 */
-	static public List<SqlQueryStat> listQueries(Connection c, String datName, Integer minSecondsRunning)
-			throws SQLException {
+	static public List<SqlQueryStat> listQueries(Connection c, String datName, Integer minSecondsRunning,
+			int filter) throws SQLException {
 		ArrayList<SqlQueryStat> result = new ArrayList<SqlQueryStat>();
 
-		String where = "where current_query not like '%IDLE%' ";
+		String where = "where 1";
+		
+	   if (filter == 1)
+			where += "AND current_query != 'IDLE' ";
+	   if (filter == 2)
+		   where += "AND current_query not like '<IDLE>%' ";
 
 		if (datName != null)
 			where += " and datname like '" + datName + "'";
@@ -898,7 +905,8 @@
 				String username = rs.getString(6);
 				String application_name = rs.getString(7);
 
-				result.add(new SqlQueryStat(q, new PGInterval(age), waiting, procId, client_addr, username, application_name));
+				result.add(new SqlQueryStat(q, new PGInterval(age), waiting, procId, client_addr, username,
+						application_name));
 			}
 
 		} finally {



More information about the Schmitzm-commits mailing list