Skip to content
Snippets Groups Projects
Commit cc353308 authored by joeappleton18's avatar joeappleton18
Browse files

updated the main method

parent 49a91bae
Branches jawid
No related tags found
No related merge requests found
......@@ -8,7 +8,6 @@ import java.util.ArrayList;
import java.util.List;
import com.yatl.util.Database;
import com.yatl.util.Seeder;
import com.yatl.model.Todo;
......@@ -17,7 +16,7 @@ public class Main {
static List<Todo> todos = new ArrayList<>();
public static void main(String[] args) {
new Seeder();
URL resourceFolderUrl = Main.class.getClassLoader().getResource("");
String databasePath = resourceFolderUrl.getPath() + "database.db";
String url = "jdbc:sqlite:" + databasePath;
......@@ -30,7 +29,12 @@ public class Main {
ResultSet rs = stmt.executeQuery("SELECT * FROM todos");
while (rs.next()) {
todos.add(new Todo(rs.getInt("id"), rs.getString("title"), rs.getBoolean("completed")));
System.out.println(todos.toString());
}
for(Todo todo: todos) {
System.out.println(todo.toString());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment