Removed redundant calls

This commit is contained in:
bm01 2012-06-28 05:35:56 +02:00
parent 2faa0356a5
commit 533955a9c7

View File

@ -139,16 +139,14 @@ public class Database {
try { try {
PreparedStatement stmt = conn.prepareStatement(sql); PreparedStatement stmt = conn.prepareStatement(sql);
if (stmt.executeQuery() != null) { stmt.executeQuery();
stmt.executeQuery(); rs = stmt.getResultSet();
rs = stmt.getResultSet(); while (rs.next()) {
while (rs.next()) { ArrayList<String> Col = new ArrayList<String>();
ArrayList<String> Col = new ArrayList<String>(); for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) { Col.add(rs.getString(i));
Col.add(rs.getString(i));
}
Rows.put(rs.getRow(), Col);
} }
Rows.put(rs.getRow(), Col);
} }
} }
catch (SQLException ex) { catch (SQLException ex) {
@ -201,16 +199,13 @@ public class Database {
if (isConnected()) { if (isConnected()) {
try { try {
PreparedStatement stmt = conn.prepareStatement(sql); PreparedStatement stmt = conn.prepareStatement(sql);
stmt = conn.prepareStatement(sql); stmt.executeQuery();
if (stmt.executeQuery() != null) { rs = stmt.getResultSet();
stmt.executeQuery(); if (rs.next()) {
rs = stmt.getResultSet(); result = rs.getInt(1);
if (rs.next()) { }
result = rs.getInt(1); else {
} result = 0;
else {
result = 0;
}
} }
} }
catch (SQLException ex) { catch (SQLException ex) {
@ -264,16 +259,14 @@ public class Database {
if (isConnected()) { if (isConnected()) {
try { try {
PreparedStatement stmt = conn.prepareStatement(sql); PreparedStatement stmt = conn.prepareStatement(sql);
if (stmt.executeQuery() != null) { stmt.executeQuery();
stmt.executeQuery(); rs = stmt.getResultSet();
rs = stmt.getResultSet(); while (rs.next()) {
while (rs.next()) { ArrayList<String> Col = new ArrayList<String>();
ArrayList<String> Col = new ArrayList<String>(); for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) { Col.add(rs.getString(i));
Col.add(rs.getString(i));
}
Rows.put(rs.getRow(), Col);
} }
Rows.put(rs.getRow(), Col);
} }
} }
catch (SQLException ex) { catch (SQLException ex) {