module Wiki (
- Backend
+ Backend (getCurrent,getList,get,setCurrent,update)
,PGB
+ ,createPGB
) where
setCurrent (PGB db) key id = do
full <- selectReturnTuples db $ "SELECT keyword FROM fulltexts WHERE keyword="++tov key++" AND id='"++id++"'"
- cur <- selectReturnTuples db $ "SELECT keyword FROM curtexts WHERE keyword='"++tov key++"'"
+ cur <- selectReturnTuples db $ "SELECT keyword FROM curtexts WHERE keyword="++tov key
case full of
[[]] -> do
- print "No text found with this id and key"
return False
_ -> do
rows <- case cur of
- [] -> do
- print "No link found in current, inserting"
- execute db $ "INSERT INTO current (keyword, id) VALUES ("++tov id++","++tov key++")"
+ [[]] -> do
+ execute db $ "INSERT INTO current (keyword, id) VALUES ("++tov key++","++tov id++")"
_ -> do
- print "Link found in current, updating"
execute db $ "UPDATE current SET id = "++tov id++" WHERE keyword = "++tov key
- print rows
if rows == 1 then return True
else return False