Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (21 sloc) 0.783 kb
module Main where
import Control.Monad
import Database.HDBC
import Database.HDBC.MySQL
go :: IO ()
go = do conn <- connectMySQL defaultMySQLConnectInfo
-- { mysqlPort = 13306
-- , mysqlDatabase = "event"
-- }
putStrLn $ "you are connected to " ++ (hdbcDriverName conn) ++
" server version " ++ (dbServerVer conn) ++
" via client version " ++ (hdbcClientVer conn)
tables <- getTables conn
putStrLn $ "the tables in this database are " ++ (show tables)
stmt <- prepare conn "SELECT NOW()"
execute stmt []
rows <- fetchAllRows stmt
forM_ rows $ \row -> putStrLn $ show row
disconnect conn
main :: IO ()
main = handleSqlError go
Jump to Line
Something went wrong with that request. Please try again.