Skip to content
This repository was archived by the owner on Sep 24, 2022. It is now read-only.

Commit baa0357

Browse files
RenlarRenlar
authored andcommitted
Fixed problem of database wrapper needing Records.masterDataList and it being empty so database was improperly generated causing loading errors and the like.
1 parent f7e1d68 commit baa0357

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/awana/database/AwanaDatabase.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
public class AwanaDatabase {
2121

22-
private static int backupCutoff = 10;
22+
private static int backupCutoff = 15;
2323

2424
/**
2525
* @param args the command line arguments
@@ -42,10 +42,9 @@ public static void main(String args[]) {
4242
java.util.logging.Logger.getLogger(DirectoryPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
4343
}
4444
//</editor-fold>
45-
backupDatabase();
4645

47-
DatabaseWrapper databaseWrapper = new DatabaseWrapper();
4846
Record.loadMasterData(); //do not remove temporary record load fix will be replaced with dynamic loading once variable yml field loading is supproted
47+
DatabaseWrapper databaseWrapper = new DatabaseWrapper(); //must call Record.loadMasterData() before creating a DatabaseWrapper
4948

5049
/* Create and display the form */
5150
DirectoryPage page;
@@ -55,6 +54,7 @@ public static void main(String args[]) {
5554
/*create the shutdown hook*/
5655
Thread t = new Thread(new Shutdown(page, databaseWrapper));
5756
Runtime.getRuntime().addShutdownHook(t);
57+
backupDatabase();
5858
}
5959

6060
private static void backupDatabase() {

src/awana/database/DatabaseWrapper.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,7 @@ public boolean tableExists(String table) {
343343
ResultSet s;
344344
try {
345345
s = executeQuery("select * from information_schema.tables where table_name = '" + dataTable + "'");
346-
if (s.first()) {
347-
return true;
348-
}
346+
return s.first();
349347
} catch (Exception ex) {
350348
Logger.getLogger("global").log(Level.SEVERE, null, ex);
351349
}

0 commit comments

Comments
 (0)