Permalink
Browse files

Compile with -Wall, and fix compile warnings

  • Loading branch information...
1 parent 797cc3a commit 8fa277a941be09f20115991078f233f176222c29 @joeyadams committed Mar 8, 2012
View
@@ -49,6 +49,8 @@ Library
text >= 0.11.1,
time
+ ghc-options: -Wall -fno-warn-name-shadowing
+
source-repository head
type: git
location: http://github.com/lpsmith/postgresql-simple
@@ -110,7 +110,6 @@ import Control.Applicative ((<$>), pure)
import Control.Concurrent.MVar
import Control.Exception (Exception, onException, throw, throwIO, finally)
import Control.Monad (foldM)
-import Control.Monad.Fix (fix)
import Data.ByteString (ByteString)
import Data.Char(ord)
import Data.Int (Int64)
@@ -195,6 +194,7 @@ formatMany conn q@(Query template) qs = do
\([^?]*)$"
[caseless]
+escapeStringConn :: Connection -> ByteString -> IO (Maybe ByteString)
escapeStringConn conn s = withConnection conn $ \c -> do
PQ.escapeStringConn c s
@@ -242,7 +242,7 @@ executeMany conn q qs = do
finishExecute conn q result
finishExecute :: Connection -> Query -> PQ.Result -> IO Int64
-finishExecute conn q result = do
+finishExecute _conn q result = do
status <- PQ.resultStatus result
case status of
PQ.CommandOk -> do
@@ -344,6 +344,7 @@ data FoldOptions
transactionMode :: !TransactionMode
}
+defaultFoldOptions :: FoldOptions
defaultFoldOptions = FoldOptions {
fetchQuantity = Automatic,
transactionMode = TransactionMode ReadCommitted ReadOnly
@@ -559,7 +560,8 @@ beginLevel lvl = beginMode defaultTransactionMode { isolationLevel = lvl }
-- | Begin a transaction with a given transaction mode
beginMode :: TransactionMode -> Connection -> IO ()
beginMode mode conn = do
- execute_ conn $! case mode of
+ _ <- execute_ conn $!
+ case mode of
TransactionMode ReadCommitted ReadWrite ->
"BEGIN"
TransactionMode ReadCommitted ReadOnly ->
@@ -195,6 +195,7 @@ exec conn sql =
Just res -> do
return res
+disconnectedError :: SqlError
disconnectedError = SqlError {
sqlNativeError = -1,
sqlErrorMsg = "connection disconnected",
@@ -36,7 +36,6 @@ import qualified Data.ByteString as B
import Database.PostgreSQL.LibPQ (Oid(..),LoFd(..))
import qualified Database.PostgreSQL.LibPQ as PQ
import Database.PostgreSQL.Simple.Internal
-import Foreign.C.Types (CInt)
import System.IO (IOMode(..),SeekMode(..))
liftPQ :: B.ByteString -> Connection -> (PQ.Connection -> IO (Maybe a)) -> IO a
@@ -29,6 +29,7 @@ data Notification = Notification
, notificationData :: B.ByteString
}
+errfd :: String
errfd = "Database.PostgreSQL.Simple.Notification.getNotification: \
\failed to fetch file descriptor"
@@ -24,14 +24,13 @@ module Database.PostgreSQL.Simple.QueryResults
) where
import Control.Applicative (Applicative(..), (<$>))
-import Control.Exception (SomeException(..), throw)
+import Control.Exception (SomeException(..))
import Data.ByteString (ByteString)
import qualified Data.ByteString.Char8 as B
import Data.Either()
import Database.PostgreSQL.Simple.Internal
import Database.PostgreSQL.Simple.Result (ResultError(..), Result(..))
import Database.PostgreSQL.Simple.Types (Only(..))
-import qualified Database.PostgreSQL.LibPQ as LibPQ (Result)
-- | A collection type that can be converted from a list of strings.
--
@@ -212,6 +211,7 @@ instance (Result a, Result b, Result c, Result d, Result e, Result f,
return (a,b,c,d,e,f,g,h,i,j)
convertResults fs vs = convertError fs vs 10
+(<$!>) :: Functor f => (a -> b) -> f a -> f b
f <$!> (!x) = f <$> x
infixl 4 <$!>
@@ -32,7 +32,7 @@ module Database.PostgreSQL.Simple.Result
#include "MachDeps.h"
import Control.Applicative (Applicative, (<$>), (<*>), (<*), pure)
-import Control.Exception (SomeException(..), Exception, throw)
+import Control.Exception (SomeException(..), Exception)
import Data.Attoparsec.Char8 hiding (Result)
import Data.Bits ((.&.), (.|.), shiftL)
import Data.ByteString (ByteString)
@@ -44,10 +44,9 @@ import Data.Time.Calendar (Day, fromGregorian)
import Data.Time.Clock (UTCTime)
import Data.Time.Format (parseTime)
import Data.Time.LocalTime (TimeOfDay, makeTimeOfDayValid)
-import Data.Typeable (TypeRep, Typeable, typeOf)
+import Data.Typeable (Typeable, typeOf)
import Data.Word (Word64)
import Database.PostgreSQL.Simple.Internal
-import Database.PostgreSQL.Simple.Field (Field(..), RawResult(..))
import Database.PostgreSQL.Simple.BuiltinTypes
import Database.PostgreSQL.Simple.Types (Binary(..), Null(..))
import qualified Database.PostgreSQL.LibPQ as PQ
@@ -58,7 +57,6 @@ import qualified Data.ByteString.Char8 as B8
import qualified Data.ByteString.Lazy as LB
import qualified Data.Text as ST
import qualified Data.Text.Encoding as ST
-import qualified Data.Text.Encoding.Error (UnicodeException)
import qualified Data.Text.Lazy as LT
-- | Exception thrown if conversion from a SQL value to a Haskell
@@ -140,6 +138,7 @@ instance Result (Ratio Integer) where
convert = atto ok rational
where ok = mkCompats [Float4,Float8,Int2,Int4,Numeric]
+unBinary :: Binary t -> t
unBinary (Binary x) = x
instance Result SB.ByteString where
@@ -228,7 +227,7 @@ mkCompat = Compat . shiftL 1 . fromEnum
compat :: Compat -> Compat -> Bool
compat (Compat a) (Compat b) = a .&. b /= 0
-okText, okText', ok16, ok32, ok64 :: Compat
+okText, okText', okBinary, ok16, ok32, ok64, okInt :: Compat
okText = mkCompats [Name,Text,Char,Bpchar,Varchar]
okText' = mkCompats [Name,Text,Char,Bpchar,Varchar,Unknown]
okBinary = mkCompats [Bytea]

0 comments on commit 8fa277a

Please sign in to comment.