Last active
December 26, 2015 21:09
-
-
Save joastbg/7213828 to your computer and use it in GitHub Desktop.
Haskell - HDBC and MySQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Control.Monad | |
| import System.IO | |
| import Database.HDBC | |
| import Database.HDBC.MySQL | |
| import Data.Char | |
| import qualified Data.Map as Map | |
| main = do conn <- connectMySQL defaultMySQLConnectInfo { | |
| mysqlUser = "testing", | |
| mysqlPassword = "testing1234", | |
| mysqlDatabase = "test" | |
| } | |
| rows <- quickQuery' conn "SELECT * from persons" [] | |
| forM_ rows $ \row -> putStrLn $ show row | |
| sth <- prepare conn "SELECT * from persons" | |
| execute sth [] | |
| cols <- getColumnNames sth | |
| forM_ cols $ \col -> putStrLn $ show col |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment