git.iko.soy/typeable/postgresql-simple
on master help sign in
Fix bug in Values syntax generation
5649f38Leon P Smith
src/Database/PostgreSQL/Simple/ToField.hs+10−8
@@ -338,14 +338,16 @@ instance ToRow a => ToField (Values a) where
338 typedRows :: ToRow a => [a] -> [QualifiedIdentifier] -> [Action] -> [Action]
338 typedRows :: ToRow a => [a] -> [QualifiedIdentifier] -> [Action] -> [Action]
339 typedRows [] _ _ = error funcname
339 typedRows [] _ _ = error funcname
340 typedRows (val:vals) types rest =
340 typedRows (val:vals) types rest =
341− typedRow (toRow val) types (litC ',' : untypedRows vals rest)
341+ typedRow (toRow val) types (multiRows vals rest)
342
342
343 untypedRows :: ToRow a => [a] -> [Action] -> [Action]
343 untypedRows :: ToRow a => [a] -> [Action] -> [Action]
344− untypedRows [] rest = rest
344+ untypedRows [] _ = error funcname
345 untypedRows (val:vals) rest =
345 untypedRows (val:vals) rest =
346− untypedRow (toRow val) $
346+ untypedRow (toRow val) (multiRows vals rest)
347+
348+ multiRows :: ToRow a => [a] -> [Action] -> [Action]
347− interleaveFoldr
349+ multiRows vals rest = interleaveFoldr
348− (untypedRow . toRow)
350+ (untypedRow . toRow)
349− (litC ',')
351+ (litC ',')
350− rest
352+ rest
351− vals
353+ vals