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

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

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

sqlite:query([handle: db, sql: "INSERT INTO things (label) VALUES (?)", params: ["apple"]])
sqlite:query([handle: db, sql: "INSERT INTO things (label) VALUES (?)", params: ["banana"]])
sqlite:query([handle: db, sql: "INSERT INTO things (label) VALUES (?)", params: ["carrot"]])

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

array:each(slog, array:collect(results))


