Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

34 lines (26 sloc) 1.028 kB
module Main where
import Control.Monad
import Database.HDBC
import Database.HDBC.MySQL
go :: IO ()
go = do conn <- connectMySQL defaultMySQLConnectInfo
{ mysqlHost = "putterwell"
}
{-
putStrLn $ "driver " ++ (show $ hdbcDriverName conn)
putStrLn $ "server version " ++ (show $ dbServerVer conn)
tables <- getTables conn
forM_ tables $ \t -> do
putStrLn $ "table " ++ t
cols <- describeTable conn t
forM_ cols $ \(name, desc) ->
putStrLn $ name ++ " " ++ (show desc)
rows0 <- quickQuery' conn "SELECT a FROM album" []
rows1 <- quickQuery' conn "SELECT str FROM album" []
forM_ (zip rows0 rows1) $ \(a, str) -> putStrLn $ "a=" ++ (show a) ++ ", str=" ++ (show str)
-}
stmt <- prepare conn "INSERT INTO album VALUES (?, ?)"
n <- execute stmt [SqlWord32 3000000000, SqlString "hello"]
commit conn
main :: IO ()
main = handleSqlError (replicateM_ 1 go)
Jump to Line
Something went wrong with that request. Please try again.