Skip to content

Instantly share code, notes, and snippets.

@krdlab
Created December 23, 2015 08:46
Show Gist options
  • Save krdlab/4355eec547ba54cd1c1a to your computer and use it in GitHub Desktop.
Save krdlab/4355eec547ba54cd1c1a to your computer and use it in GitHub Desktop.
{-# LANGUAGE OverloadedStrings #-}
import qualified Database.MySQL.Base as MySQL
import Database.MySQL.Base (defaultConnectInfo, ConnectInfo(..), Option(..))
test :: IO ()
test = do
let conf = defaultConnectInfo {
connectHost = "172.17.0.2"
, connectDatabase = "testapp"
, connectUser = "tester"
, connectPassword = "tester"
, connectOptions = [CharsetName "utf8mb4"]
}
c <- MySQL.connect conf
MySQL.query c "select 1 + 1"
res <- MySQL.useResult c
row <- MySQL.fetchRow res
print row
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment