(
(dbwrite .
(
(dbinitsql . (
"create table if not exists targets(id integer primary key,name)"
"create table if not exists runs(id integer primary key,target_id,name,path,state,status)"
"create table if not exists tests(id integer primary key,run_id,name,path,state,status,host)"
"create table if not exists test_steps(id integer primary key,test_id,name,state)" ))
( new-target . "insert into targets (name) values(?);")
( new-run . "insert into runs (target_id,name,path,state,status) values(?,?,\"/dev/null\",\"NOT STARTED\",\"n/a\")")
( new-test . "insert into tests values(?,?,?,\"/dev/null\",\"NOT STARTED\")")
( update-one-run_id-state-status . "update runs set state=? status=? where id=?" )
( update-one-test_id-state-status . "update tests set state=? status=? where id=?" )
( update-matching-tests-state-status . "update tests set state=? status=? where run_id=?, state like ?, status like ?")
)
)
(dbread .
(
(get-targets . "select id,name from targets")
(target-name->target-id . "select id from targets where name=?")
(target-id->target-name . "select name from targets where id=?")
(check-test-state-status . "select state,status from tests where id=?")
)
)
)