I am asking here second time today.
There is a function isFileInstalled which passes parameter f to execParamStatement as parameter. The problem is that when it's called with parameter f == "/usr/bin/getpkg" (or another) it's not exiting application when there is row with path == f.
Also, when exiting a message should appear. To do this I need to read owner and path columns.
How can I do this? Can you write an examl
isFileInstalled f = do
dbcon <- openReadonlyConnection "/var/lib/beaver/pkgs.db"
res <- execParamStatement dbcon "SELECT * FROM files WHERE path = :path" [(":path", f)] :: IO (Either String [[Row Value]])
when (null res) (return ())
putStrLn ("File " ++ res ++ " is already installed and comes from " ++ res ++ ".") -- first res is `owner` and second is `path`
closeConnection dbcon
exit
files table:
owner | path
------------------------------
getpkg.py | /usr/bin/getpkg
getpkg.py | /usr/bin/getpkg.py
Aucun commentaire:
Enregistrer un commentaire