Added map and foreach support on queries

This commit is contained in:
Maas-Maarten Zeeman
2011-11-21 09:28:25 +01:00
parent a1a082acf8
commit 20b5d9cea1

View File

@@ -95,9 +95,10 @@ foreach_test() ->
esqlite3:foreach(F, "select * from test_table", Db), esqlite3:foreach(F, "select * from test_table", Db),
2 = get("one"), 10 = get("hello1"),
4 = get("three"), 11 = get("hello2"),
6 = get(<<"five">>), 12 = get("hello3"),
13 = get("hello4"),
ok. ok.
@@ -111,11 +112,9 @@ map_test() ->
ok = esqlite3:exec(["insert into test_table values(", "\"hello4\"", ",", "13" ");"], Db), ok = esqlite3:exec(["insert into test_table values(", "\"hello4\"", ",", "13" ");"], Db),
ok = esqlite3:exec("commit;", Db), ok = esqlite3:exec("commit;", Db),
F = fun(Row) -> F = fun(Row) -> Row end,
Row
end,
ok = esqlite3:map(F, "select * from test_table", Db), [{"hello1",10},{"hello2",11},{"hello3",12},{"hello4",13}] = esqlite3:map(F, "select * from test_table", Db),
ok. ok.