Skip to content

Commit

Permalink
fixed a bug in existTable() method resulting an error message on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
albogdano committed Mar 25, 2020
1 parent c2324c0 commit 85068e0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/main/java/com/erudika/para/persistence/SqlUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,11 @@ public static boolean existsTable(String appid) {
return false;
}
try (PreparedStatement ps = connection.prepareStatement(
"SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = ?")) {
ps.setString(1, getTableNameForAppid(appid).toUpperCase());
"SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = ? OR TABLE_NAME = ?")) {
ps.setString(1, getTableNameForAppid(appid));
ps.setString(2, getTableNameForAppid(appid).toUpperCase());
try (ResultSet res = ps.executeQuery()) {
if (res.next()) {
String name = res.getString(1);
return name != null;
}
return res.next() && res.getString(1) != null;
}
}
} catch (Exception e) {
Expand Down

0 comments on commit 85068e0

Please sign in to comment.