hdbc-postgresql-hstore- Manipulate data in PostgreSQL "hstore" columns.

Safe HaskellSafe-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)


Make a query

hsQuery :: [(String, String)] -> StringSource

Generate a placeholder string.

hsParams :: [(String, String)] -> [SqlValue]Source

Generate a parameter list.

Parse results

hsParse :: SqlValue -> Map Text TextSource

Parse a SqlByteString with hstore data to a Map Text Text.

Parser internals

hstoreParser :: Parser (Map Text Text)Source

Parse hstore-formatted value.

kvPair :: Parser (Text, Text)Source

Parse one key-value pair.

doubleQuoted :: Parser TextSource

Grab a value, unquote, unslash.