git.iko.soy/typeable/postgresql-simple
on master help sign in
Documentation fixes
commit93c556f8d4dbf724cd26902fa2a2aebf10c50d29 authorLeon P Smith <leon@melding-monads.com> dateWed 19 Jun 2013, 00:44 (13 years ago) parent3cdc79d
1 file changed+7−5
src/Database/PostgreSQL/Simple.hs+7−5
src/Database/PostgreSQL/Simple.hs+7−5
@@ -696,7 +696,7 @@ fmtError msg q xs = throw FormatError {
696696--
697697-- The obvious approach would appear to be something like this:
698698--
699−-- > instance (Param a) => QueryParam a where
699+-- > instance (ToField a) => ToRow a where
700700-- > ...
701701--
702702-- Unfortunately, this wreaks havoc with type inference, so we take a
@@ -775,9 +775,10 @@ fmtError msg q xs = throw FormatError {
775775
776776-- $returning
777777--
778−-- The 'returning' function is similar to 'executeMany' but is
779−-- intended for use with multi-tuple @INSERT@ or @UPDATE@ statements
780−-- that make use of @RETURNING@.
778+-- PostgreSQL supports returning values from data manipulation statements
779+-- such as @INSERT@ and @UPDATE@. You can use these statements by
780+-- using 'query' instead of 'execute'. For multi-tuple inserts,
781+-- use 'returning' instead of 'executeMany'.
781782--
782783-- For example, were there an auto-incrementing @id@ column and
783784-- timestamp column @t@ that defaulted to the present time for the
@@ -785,7 +786,8 @@ fmtError msg q xs = throw FormatError {
785786-- sales records and also return their new @id@s and timestamps.
786787--
787788-- > let q = "insert into sales (amount, label) values (?,?) returning id, t"
788−-- > xs :: [(Int, UTCTime)] <- returning conn q [(20,"Chips"),(300,"Wood")]
789+-- > xs :: [(Int, UTCTime)] <- query conn q (15,"Sawdust")
790+-- > ys :: [(Int, UTCTime)] <- returning conn q [(20,"Chips"),(300,"Wood")]
789791
790792-- $result
791793--