Skip to content

Instantly share code, notes, and snippets.

@MBunel
Created May 14, 2018 23:18
Show Gist options
  • Save MBunel/df518b324c07a0aff3af96554404eeb7 to your computer and use it in GitHub Desktop.
Save MBunel/df518b324c07a0aff3af96554404eeb7 to your computer and use it in GitHub Desktop.
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