@@ -1,5 +1,6 @@
1−{-# LANGUAGE BangPatterns, DeriveDataTypeable, OverloadedStrings, DoAndIfThenElse, RecordWildCards, NamedFieldPuns #-}
1+{-# LANGUAGE BangPatterns, DeriveDataTypeable, OverloadedStrings #-}
2−
2+{-# LANGUAGE DoAndIfThenElse, RecordWildCards, NamedFieldPuns #-}
3+------------------------------------------------------------------------------
4-- Module: Database.PostgreSQL.Simple
5-- Module: Database.PostgreSQL.Simple
5-- Copyright: (c) 2011 MailRank, Inc.
6-- Copyright: (c) 2011 MailRank, Inc.
@@ -9,8 +10,10 @@
9-- Stability: experimental
10-- Stability: experimental
10-- Portability: portable
11-- Portability: portable
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
13-- use and high performance.
14-- use and high performance.
16+------------------------------------------------------------------------------
15module Database.PostgreSQL.Simple
18module Database.PostgreSQL.Simple
@@ -436,8 +439,8 @@ withResult fetchResult q act = bracket fetchResult Base.freeResult $ \r -> do
436-- 'Base.commit' before this function returns.
439-- 'Base.commit' before this function returns.
438-- If the action throws /any/ kind of exception (not just a
441-- If the action throws /any/ kind of exception (not just a
439−-- MySQL-related exception), the transaction will be rolled back using
442+-- PostgreSQL-related exception), the transaction will be rolled back using
440−-- 'Base.rollback', then the exception will be rethrown.
443+-- 'rollback', then the exception will be rethrown.
441withTransaction :: Connection -> IO a -> IO a
444withTransaction :: Connection -> IO a -> IO a
442withTransaction conn act = do
445withTransaction conn act = do
443 _ <- begin conn
446 _ <- begin conn
@@ -449,21 +452,21 @@ withTransaction conn act = do
449-- rollback :: (MonadCatchIO m,MonadIO m) => Connection -> m ()
452-- rollback :: (MonadCatchIO m,MonadIO m) => Connection -> m ()
450rollback :: Connection -> IO ()
453rollback :: Connection -> IO ()
451rollback conn = do
454rollback conn = do
452− _ <- execute_ conn "ABORT;"
455+ _ <- execute_ conn "ABORT"
453 return ()
456 return ()
455-- | Commit a transaction.
458-- | Commit a transaction.
456-- commit :: (MonadCatchIO m,MonadIO m) => Connection -> m ()
459-- commit :: (MonadCatchIO m,MonadIO m) => Connection -> m ()
457commit :: Connection -> IO ()
460commit :: Connection -> IO ()
458commit conn = do
461commit conn = do
459− _ <- execute_ conn "COMMIT;"
462+ _ <- execute_ conn "COMMIT"
460 return ()
463 return ()
462-- | Begin a transaction.
465-- | Begin a transaction.
463-- begin :: (MonadCatchIO m,MonadIO m) => Connection -> m ()
466-- begin :: (MonadCatchIO m,MonadIO m) => Connection -> m ()
464begin :: Connection -> IO ()
467begin :: Connection -> IO ()
465begin conn = do
468begin conn = do
466− _ <- execute_ conn "BEGIN;"
469+ _ <- execute_ conn "BEGIN"
467 return ()
470 return ()
469fmtError :: String -> Query -> [Action] -> a
472fmtError :: String -> Query -> [Action] -> a
@@ -500,7 +503,7 @@ fmtError msg q xs = throw FormatError {
501-- > {-# LANGUAGE OverloadedStrings #-}
504-- > {-# LANGUAGE OverloadedStrings #-}
503−-- > import Database.MySQL.Simple
506+-- > import Database.PostgreSQL.Simple
505-- > hello = do
508-- > hello = do
506-- > conn <- connect defaultConnectInfo
509-- > conn <- connect defaultConnectInfo
@@ -707,16 +710,15 @@ fmtError msg q xs = throw FormatError {
707-- permissive. Here are the rules.
710-- permissive. Here are the rules.
709-- * For numeric types, any Haskell type that can accurately represent
712-- * For numeric types, any Haskell type that can accurately represent
710−-- all values of the given MySQL type is considered \"compatible\".
713+-- all values of the given PostgreSQL type is considered \"compatible\".
711−-- For instance, you can always extract a MySQL @TINYINT@ column to
714+-- For instance, you can always extract a PostgreSQL 16-bit @SMALLINT@
712−-- a Haskell 'Int'. The Haskell 'Float' type can accurately
715+-- column to 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.
716+-- represent a @SMALLINT@, so it is considered compatble with those types.
716-- * A numeric compatibility check is based only on the type of a
718-- * A numeric compatibility check is based only on the type of a
717−-- column, /not/ on its values. For instance, a MySQL @LONG_LONG@
719+-- column, /not/ on its values. For instance, a PostgreSQL 64-bit
718−-- column will be considered incompatible with a Haskell 'Int8',
720+-- @BIGINT@ column will be considered incompatible with a Haskell
719−-- even if it contains the value @1@.
721+-- 'Int16', even if it contains the value @1@.
721-- * If a numeric incompatibility is found, 'query' will throw a
723-- * If a numeric incompatibility is found, 'query' will throw a
722-- 'ResultError'.
724-- 'ResultError'.