Safe Haskell | Safe-Infered |
---|
Read and write stuff in hstore columns.
Insert crap into table:
let myStuff = [("test", "shmest"), ("spam", "eggs"), ("sausage", "salad")] withTransaction conn $ trans -> run trans ("INSERT INTO test_hstore (stuff) VALUES (" ++ hsQuery myStuff ++ ");") (hsParams myStuff)
Parse hstore data:
rows <- quickQuery conn "SELECT * FROM test_hstore;" [] forM_ rows $ [pk, hstuff] -> print $ (fromSql pk :: Integer, hsParse hstuff)