Skip to content

Commit

Permalink
update[DbWrapper]: remove input for script and database paths
Browse files Browse the repository at this point in the history
remove input for scripts and database paths for ease of use
  • Loading branch information
Lucy Ciara Herud-Thomassen authored and Lucy Ciara Herud-Thomassen committed Mar 10, 2026
1 parent b312097 commit 1c56f3c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/main/java/edu/group5/app/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
public class App {
public static void main(String[] args) throws InterruptedException {
DbWrapper db = new DbWrapper("test_init.sql");
DbWrapper db = new DbWrapper(false);
try {
System.out.println(db.connect());
} catch (Exception e) {
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/edu/group5/app/control/DbWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ public class DbWrapper {
private static final String DB_SCRIPT = "INIT=RUNSCRIPT FROM 'classpath:";
private String connectionString;

public DbWrapper(String script) {
this(script, "mem:test;");
}

public DbWrapper(String script, String dbPath) {
this.connectionString = CONNECTION_TYPE + dbPath + DB_SCRIPT + script + "'";
public DbWrapper(boolean test) {
if (test) {
this.connectionString = CONNECTION_TYPE + "mem:test;" + DB_SCRIPT + "test_init.sql'";
} else {
this.connectionString = CONNECTION_TYPE + "file:./help-me-help;" + DB_SCRIPT + "init.sql'";
}
}

public boolean connect() throws SQLException {
Expand All @@ -26,5 +26,4 @@ public boolean connect() throws SQLException {
}
return connection.isValid(0);
}

}

0 comments on commit 1c56f3c

Please sign in to comment.