@@ -1,5 +1,6 @@
1−{-# LANGUAGE BangPatterns, DeriveDataTypeable, OverloadedStrings, DoAndIfThenElse, RecordWildCards, NamedFieldPuns #-}
2−
1+{-# LANGUAGE BangPatterns, DeriveDataTypeable, OverloadedStrings #-}
2+{-# LANGUAGE DoAndIfThenElse, RecordWildCards, NamedFieldPuns #-}
3+------------------------------------------------------------------------------
34-- |
45-- Module: Database.PostgreSQL.Simple
56-- Copyright: (c) 2011 MailRank, Inc.
@@ -9,8 +10,10 @@
910-- Stability: experimental
1011-- Portability: portable
1112--
12−-- A mid-level client library for the MySQL database, aimed at ease of
13+-- A mid-level client library for the PostgreSQL database, aimed at ease of
1314-- use and high performance.
15+--
16+------------------------------------------------------------------------------
1417
1518module Database.PostgreSQL.Simple
1619 (
@@ -436,8 +439,8 @@ withResult fetchResult q act = bracket fetchResult Base.freeResult $ \r -> do
436439-- 'Base.commit' before this function returns.
437440--
438441-- If the action throws /any/ kind of exception (not just a
439−-- MySQL-related exception), the transaction will be rolled back using
440−-- 'Base.rollback', then the exception will be rethrown.
442+-- PostgreSQL-related exception), the transaction will be rolled back using
443+-- 'rollback', then the exception will be rethrown.
441444withTransaction :: Connection -> IO a -> IO a
442445withTransaction conn act = do
443446 _ <- begin conn
@@ -449,21 +452,21 @@ withTransaction conn act = do
449452-- rollback :: (MonadCatchIO m,MonadIO m) => Connection -> m ()
450453rollback :: Connection -> IO ()
451454rollback conn = do
452− _ <- execute_ conn "ABORT;"
455+ _ <- execute_ conn "ABORT"
453456 return ()
454457
455458-- | Commit a transaction.
456459-- commit :: (MonadCatchIO m,MonadIO m) => Connection -> m ()
457460commit :: Connection -> IO ()
458461commit conn = do
459− _ <- execute_ conn "COMMIT;"
462+ _ <- execute_ conn "COMMIT"
460463 return ()
461464
462465-- | Begin a transaction.
463466-- begin :: (MonadCatchIO m,MonadIO m) => Connection -> m ()
464467begin :: Connection -> IO ()
465468begin conn = do
466− _ <- execute_ conn "BEGIN;"
469+ _ <- execute_ conn "BEGIN"
467470 return ()
468471
469472fmtError :: String -> Query -> [Action] -> a
@@ -500,7 +503,7 @@ fmtError msg q xs = throw FormatError {
500503--
501504-- > {-# LANGUAGE OverloadedStrings #-}
502505-- >
503−-- > import Database.MySQL.Simple
506+-- > import Database.PostgreSQL.Simple
504507-- >
505508-- > hello = do
506509-- > conn <- connect defaultConnectInfo
@@ -707,16 +710,15 @@ fmtError msg q xs = throw FormatError {
707710-- permissive. Here are the rules.
708711--
709712-- * For numeric types, any Haskell type that can accurately represent
710−-- all values of the given MySQL type is considered \"compatible\".
711−-- For instance, you can always extract a MySQL @TINYINT@ column to
712−-- a Haskell 'Int'. The Haskell 'Float' type can accurately
713−-- represent MySQL integer types of size up to @INT24@, so it is
714−-- considered compatble with those types.
713+-- all values of the given PostgreSQL type is considered \"compatible\".
714+-- For instance, you can always extract a PostgreSQL 16-bit @SMALLINT@
715+-- column to a Haskell 'Int'. The Haskell 'Float' type can accurately
716+-- represent a @SMALLINT@, so it is considered compatble with those types.
715717--
716718-- * A numeric compatibility check is based only on the type of a
717−-- column, /not/ on its values. For instance, a MySQL @LONG_LONG@
718−-- column will be considered incompatible with a Haskell 'Int8',
719−-- even if it contains the value @1@.
719+-- column, /not/ on its values. For instance, a PostgreSQL 64-bit
720+-- @BIGINT@ column will be considered incompatible with a Haskell
721+-- 'Int16', even if it contains the value @1@.
720722--
721723-- * If a numeric incompatibility is found, 'query' will throw a
722724-- 'ResultError'.