Created
May 14, 2018 23:18
-
-
Save MBunel/df518b324c07a0aff3af96554404eeb7 to your computer and use it in GitHub Desktop.
This file contains 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 Database.HDBC | |
import Database.HDBC.PostgreSQL | |
main = do | |
conn <- connectPostgreSQL "dbname=postgres user=postgres" | |
run conn "TRUNCATE test;" [] | |
insert <- prepare conn "INSERT INTO test VALUES (?);" | |
executeMany insert values | |
commit conn | |
disconnect conn | |
myfun :: [Int] -> [[SqlValue]] | |
myfun x = map (\v -> [toSql v]) x | |
values = myfun [11..111] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment