+ --Keyword -> id -> ()
+ setCurrent :: a -> String -> String -> IO Int
+
+ --Keyword -> Full text -> id
+ addNew :: a -> String -> String -> IO String
+
+data PGB = PGB DBService
+
+createPGB :: String -> String -> String -> String -> IO PGB
+createPGB host database user password = let db = createDBService host database "" user password Nothing in return (PGB db)
+
+
+testDB = createPGB "wave" "wiki" "wiki" "12wiki34db"
+
+instance WB PGB where
+
+ getCurrent (PGB db) key = do
+ [[text,date]] <- selectReturnTuples db $ "SELECT fulltext,timestamp FROM curtexts where keyword='"++(escapeQuery key)++"'"
+ return (text,date)
+
+ getList (PGB db) key = do
+ list <- selectReturnTuples db $ "SELECT id, timestamp, author, comment from fulltexts where keyword = '"++(escapeQuery key)++"'"
+ return $ map (\[id,date,author,comment] -> (id,date,author,comment)) list
+
+ get (PGB db) key id = return ""
+
+ setCurrent (PGB db) key id =
+ execute db $ "UPDATE current SET id = '"++(escapeQuery id)++"' where keyword = '"++(escapeQuery key)++"'"
+
+ addNew (PGB db) key text = return ""