From 533955a9c7cd78cd83007ee2571aa061c7380a25 Mon Sep 17 00:00:00 2001 From: bm01 Date: Thu, 28 Jun 2012 05:35:56 +0200 Subject: [PATCH] Removed redundant calls --- .../java/com/gmail/nossr50/util/Database.java | 49 ++++++++----------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/util/Database.java b/src/main/java/com/gmail/nossr50/util/Database.java index 1cb0aef75..af8f9daf4 100644 --- a/src/main/java/com/gmail/nossr50/util/Database.java +++ b/src/main/java/com/gmail/nossr50/util/Database.java @@ -139,16 +139,14 @@ public class Database { try { PreparedStatement stmt = conn.prepareStatement(sql); - if (stmt.executeQuery() != null) { - stmt.executeQuery(); - rs = stmt.getResultSet(); - while (rs.next()) { - ArrayList Col = new ArrayList(); - for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) { - Col.add(rs.getString(i)); - } - Rows.put(rs.getRow(), Col); + stmt.executeQuery(); + rs = stmt.getResultSet(); + while (rs.next()) { + ArrayList Col = new ArrayList(); + for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) { + Col.add(rs.getString(i)); } + Rows.put(rs.getRow(), Col); } } catch (SQLException ex) { @@ -201,16 +199,13 @@ public class Database { if (isConnected()) { try { PreparedStatement stmt = conn.prepareStatement(sql); - stmt = conn.prepareStatement(sql); - if (stmt.executeQuery() != null) { - stmt.executeQuery(); - rs = stmt.getResultSet(); - if (rs.next()) { - result = rs.getInt(1); - } - else { - result = 0; - } + stmt.executeQuery(); + rs = stmt.getResultSet(); + if (rs.next()) { + result = rs.getInt(1); + } + else { + result = 0; } } catch (SQLException ex) { @@ -264,16 +259,14 @@ public class Database { if (isConnected()) { try { PreparedStatement stmt = conn.prepareStatement(sql); - if (stmt.executeQuery() != null) { - stmt.executeQuery(); - rs = stmt.getResultSet(); - while (rs.next()) { - ArrayList Col = new ArrayList(); - for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) { - Col.add(rs.getString(i)); - } - Rows.put(rs.getRow(), Col); + stmt.executeQuery(); + rs = stmt.getResultSet(); + while (rs.next()) { + ArrayList Col = new ArrayList(); + for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) { + Col.add(rs.getString(i)); } + Rows.put(rs.getRow(), Col); } } catch (SQLException ex) {