extend("sqlite")
extend("array")

db = sqlite:open([path: "demo1.db"])

sqlite:query([handle: db, sql: "DROP TABLE IF EXISTS food", params: []])
sqlite:query([handle: db, sql: "CREATE TABLE food (id INTEGER PRIMARY KEY, name TEXT)", params: []])

array:each( fruit => {
  sqlite:query([handle: db, sql: "INSERT INTO food (name) VALUES (?)", params: [fruit]])
}, ["peach", "cherry", "plum"])

results = sqlite:query([handle: db, sql: "SELECT id, name FROM food", params: []])

slog(results)


