fix tests
[sqlgg.git] / example / test_caml.ml
blob2a4484adec79ff528b6557723da273418891be0d
2 open Printf
3 open Sqlite3
5 module G = Test_caml_gen.Sqlgg(Sqlgg_sqlite3)
7 let explain msg db = printf "%s : %s\n" msg (errmsg db)
9 let main () =
10 let db = db_open ":memory:" in
11 explain "open" db;
14 G.drop_test db;
15 explain "drop" db;
16 G.drop_loc db;
17 explain "drop" db;
18 G.drop_zuzu db;
19 explain "drop" db;
22 G.create_test db;
23 explain "create" db;
25 G.add db "c++" "ugly";
26 explain "insert" db;
28 G.add db "c" "hard";
29 explain "insert" db;
31 G.add db "ocaml" "wonderful";
32 explain "insert" db;
34 G.exaggerate db "really";
35 explain "update" db;
37 G.select_all db (fun id name descr -> printf "%Lu) %s is %s\n" id name descr);
38 explain "select" db;
40 G.create_loc db;
41 explain "create_loc" db;
43 G.create_zuzu db "qq";
44 explain "create_zuzu" db;
46 let ok = db_close db in
47 printf "close: %B\n" ok;
51 let _ =
52 Printexc.print main ()