postgresql-simple 0.4.8.0 → 0.4.9.0
raw patch · 8 files changed
+19/−13 lines, 8 filesdep ~postgresql-libpq
Dependency ranges changed: postgresql-libpq
Files
- CONTRIBUTORS +2/−0
- postgresql-simple.cabal +3/−3
- src/Database/PostgreSQL/Simple/Arrays.hs +1/−1
- src/Database/PostgreSQL/Simple/Errors.hs +1/−1
- src/Database/PostgreSQL/Simple/FromField.hs +9/−6
- src/Database/PostgreSQL/Simple/SqlQQ.hs +1/−1
- src/Database/PostgreSQL/Simple/Time/Implementation.hs +1/−1
- test/Main.hs +1/−0
CONTRIBUTORS view
@@ -18,3 +18,5 @@ Tobias Florek <tob@butter.sh> Francesco Mazzoli <francesco.mazzoli@erudify.com> Chris Allen <cma@bitemyapp.com>+Simon Hengel <sol@typeful.net>+Tom Ellis <tom-2013@purelyagile.com>
postgresql-simple.cabal view
@@ -1,5 +1,5 @@ Name: postgresql-simple-Version: 0.4.8.0+Version: 0.4.9.0 Synopsis: Mid-Level PostgreSQL client library Description: Mid-Level PostgreSQL client library, forked from mysql-simple.@@ -61,7 +61,7 @@ case-insensitive, containers, hashable,- postgresql-libpq >= 0.9,+ postgresql-libpq >= 0.9 && < 0.10, template-haskell, text >= 0.11.1, time,@@ -82,7 +82,7 @@ source-repository this type: git location: http://github.com/lpsmith/postgresql-simple- tag: v0.4.8.0+ tag: v0.4.9.0 test-suite test type: exitcode-stdio-1.0
src/Database/PostgreSQL/Simple/Arrays.hs view
@@ -17,7 +17,7 @@ import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as B import Data.Monoid-import Data.Attoparsec.Char8+import Data.Attoparsec.ByteString.Char8 -- | Parse one of three primitive field formats: array, quoted and plain.
src/Database/PostgreSQL/Simple/Errors.hs view
@@ -28,7 +28,7 @@ import Control.Applicative import Control.Exception as E -import Data.Attoparsec.Char8+import Data.Attoparsec.ByteString.Char8 import Data.ByteString (ByteString) import Data.Typeable
src/Database/PostgreSQL/Simple/FromField.hs view
@@ -105,6 +105,7 @@ , typeOid , PQ.Oid(..) , PQ.Format(..)+ , pgArrayFieldParser , fromJSONField ) where@@ -490,27 +491,29 @@ -- | any postgresql array whose elements are compatible with type @a@ instance (FromField a, Typeable a) => FromField (PGArray a) where- fromField f mdat = do+ fromField = pgArrayFieldParser fromField++pgArrayFieldParser :: Typeable a => FieldParser a -> FieldParser (PGArray a)+pgArrayFieldParser fieldParser f mdat = do info <- typeInfo f case info of TI.Array{} -> case mdat of Nothing -> returnError UnexpectedNull f "" Just dat -> do- case parseOnly (fromArray info f) dat of+ case parseOnly (fromArray fieldParser info f) dat of Left err -> returnError ConversionFailed f err Right conv -> PGArray <$> conv _ -> returnError Incompatible f "" -fromArray :: (FromField a)- => TypeInfo -> Field -> Parser (Conversion [a])-fromArray typeInfo f = sequence . (parseIt <$>) <$> array delim+fromArray :: FieldParser a -> TypeInfo -> Field -> Parser (Conversion [a])+fromArray fieldParser typeInfo f = sequence . (parseIt <$>) <$> array delim where delim = typdelim (typelem typeInfo) fElem = f{ typeOid = typoid (typelem typeInfo) } parseIt item =- fromField f' $ if item' == "NULL" then Nothing else Just item'+ fieldParser f' $ if item' == "NULL" then Nothing else Just item' where item' = fmt delim item f' | Arrays.Array _ <- item = f
src/Database/PostgreSQL/Simple/SqlQQ.hs view
@@ -17,7 +17,7 @@ -- | 'sql' is a quasiquoter that eases the syntactic burden -- of writing big sql statements in Haskell source code. For example: ----- > {-# LANGUAGE QuasiQuotes #-}+-- > {-# LANGUAGE OverloadedStrings, QuasiQuotes #-} -- > -- > query conn [sql| SELECT column_a, column_b -- > FROM table1 NATURAL JOIN table2
src/Database/PostgreSQL/Simple/Time/Implementation.hs view
@@ -25,7 +25,7 @@ import Data.Time hiding (getTimeZone, getZonedTime) import Data.Typeable import Data.Word(Word8)-import qualified Data.Attoparsec.Char8 as A+import qualified Data.Attoparsec.ByteString.Char8 as A import Data.Monoid(Monoid(..)) import Data.Fixed (Pico) import Unsafe.Coerce
test/Main.hs view
@@ -167,6 +167,7 @@ testHStore :: TestEnv -> Test testHStore TestEnv{..} = TestCase $ do+ execute_ conn "CREATE EXTENSION IF NOT EXISTS hstore" roundTrip [] roundTrip [("foo","bar"),("bar","baz"),("baz","hello")] roundTrip [("fo\"o","bar"),("b\\ar","baz"),("baz","\"value\\with\"escapes")]