Passing more tests

This commit is contained in:
Imbus 2024-05-03 08:34:33 +02:00
parent 9425d585bf
commit 43668dc8d3

View file

@ -22,8 +22,8 @@ public class Database {
// "jdbc:sqlite:<filename>.sqlite3" to use a file-based database instead.
// Nore that ":memory:" is an **SQLite specific** magic string that tells the
// underlying SQLite engine to store the database in memory.
// private static final String jdbcString = "jdbc:sqlite::memory:";
private static final String jdbcString = "jdbc:sqlite:krusty.db";
private static final String jdbcString = "jdbc:sqlite::memory:";
// private static final String jdbcString = "jdbc:sqlite:krusty.db";
private Connection conn = null;
public String getCustomers(Request req, Response res) {
@ -34,11 +34,14 @@ public class Database {
}
public String getRawMaterials(Request req, Response res) {
return "{}";
String result = selectQuery("ingredients", "raw-materials", "ingredient_name", "amount", "unit");
result = result.replaceAll("ingredient_name", "name");
return result;
}
public String getCookies(Request req, Response res) {
String result = selectQuery("recipes", "cookies", "recipe_name");
result = result.replaceAll("recipe_name", "name");
return result;
}