10 --Keyword -> (Full text,date)
11 getCurrent :: a -> String -> IO (String,String)
13 --Keyword -> [(id,date)]
14 getList :: a -> String -> IO [(String, String, String, String)]
16 --Keyword -> id -> Full text
17 get :: a -> String -> String -> IO String
20 setCurrent :: a -> String -> String -> IO ()
22 --Keyword -> Full text -> id
23 addNew :: a -> String -> String -> IO String
25 data PGB = PGB DBService
27 createPGB :: String -> String -> String -> String -> IO PGB
28 createPGB host database user password = let db = createDBService host database "" user password Nothing in return (PGB db)
31 testDB = createPGB "wave" "wiki" "wiki" "12wiki34db"
35 getCurrent (PGB db) key = do
36 [[text,date]] <- selectReturnTuples db $ "SELECT fulltext,timestamp FROM curtexts where keyword='"++key++"'"
39 getList (PGB db) key = do
40 list <- selectReturnTuples db $ "SELECT id, timestamp, author, comment from fulltexts where keyword = '"++key++"'"
41 return $ map (\[id,date,author,comment] -> (id,date,author,comment)) list
43 get (PGB db) key id = return ""
45 setCurrent (PGB db) key id = return ()
47 addNew (PGB db) key text = return ""