packages feed

postgresql-simple 0.6.4 → 0.6.5

raw patch · 9 files changed

+39/−25 lines, 9 filesdep ~basedep ~template-haskell

Dependency ranges changed: base, template-haskell

Files

CHANGES.md view
@@ -1,3 +1,7 @@+### Version 0.6.5 (2022-10-30)++  * Add `withConnect`+ ### Version 0.6.4 (2021-01-06)    * Add foldCopyData helper function@@ -253,7 +257,7 @@     support UTF8 except for Mule Internal Code,  the Multilingual     Extensions for Emacs.   An exception should be raised upon     connecting to a database by the backend if the backend cannot-    accomodate this requirement.+    accommodate this requirement.    * Added `Eq` and `Typeable` instances for `Connection`. @@ -391,7 +395,7 @@    * Changed the Identifier and QualifiedIdentifier to use Text in     order to avoid encoding errors.  Technically this requires a-    major verson bump, but let's pretend 0.4.1.0 didn't happen.+    major version bump, but let's pretend 0.4.1.0 didn't happen.    * Removed non-exhaustive cases in the ToField instance for Values,     and tweaked error messages.@@ -551,7 +555,7 @@    * Added a brand new TypeInfo system that gives FromField instances     convenient and efficient access to the pg_type metatable.   This-    replaced the older typename cache,  and was neccesary to properly+    replaced the older typename cache,  and was necessary to properly     support postgres array types.   Thanks to Bas van Dijk for his     work on this feature. @@ -643,7 +647,7 @@         now the preferred way of dealing with `timestamp` (without time zone).        * `Database.PostgreSQL.Simple.Time` is a new module that offers types-        that accomodate PostgreSQL's infinities.+        that accommodate PostgreSQL's infinities.        * All time-related `FromField`/`ToField` instances are now based on new,         higher-speed parsers and printers instead of those provided by the
postgresql-simple.cabal view
@@ -1,6 +1,6 @@ cabal-version:      1.12 name:               postgresql-simple-version:            0.6.4+version:            0.6.5 synopsis:           Mid-Level PostgreSQL client library description:   Mid-Level PostgreSQL client library, forked from mysql-simple.@@ -31,7 +31,10 @@    || ==8.4.4    || ==8.6.5    || ==8.8.4-   || ==8.10.3+   || ==8.10.7+   || ==9.0.2+   || ==9.2.4+   || ==9.4.2  library   default-language:   Haskell2010@@ -77,31 +80,31 @@    -- GHC bundled libs   build-depends:-      base              >=4.6.0.0  && <4.15+      base              >=4.6.0.0  && <4.18     , bytestring        >=0.10.0.0 && <0.12     , containers        >=0.5.0.0  && <0.7-    , template-haskell  >=2.8.0.0  && <2.17-    , text              >=1.2.3.0  && <1.3+    , template-haskell  >=2.8.0.0  && <2.20+    , text              >=1.2.3.0  && <1.3 || >=2.0 && <2.1     , time-compat       >=1.9.5    && <1.12-    , transformers      >=0.3.0.0  && <0.6+    , transformers      >=0.3.0.0  && <0.7    -- Other dependencies   build-depends:-      aeson               >=1.4.1.0    && <1.6-    , attoparsec          >=0.13.2.2   && <0.14+      aeson               >=1.4.1.0    && <1.6 || >=2.0.0.0 && <2.2+    , attoparsec          >=0.13.2.2   && <0.15     , bytestring-builder  >=0.10.8.1.0 && <0.11     , case-insensitive    >=1.2.0.11   && <1.3-    , hashable            >=1.2.7.0    && <1.4+    , hashable            >=1.2.7.0    && <1.5     , Only                >=0.1        && <0.1.1     , postgresql-libpq    >=0.9.4.3    && <0.10     , scientific          >=0.3.6.2    && <0.4     , uuid-types          >=1.0.3      && <1.1-    , vector              >=0.12.0.1   && <0.13+    , vector              >=0.12.0.1   && <0.14    if !impl(ghc >=8.0)     build-depends:         fail        >=4.9.0.0 && <4.10-      , semigroups  >=0.18.5  && <0.20+      , semigroups  >=0.18.5  && <0.21    if !impl(ghc >=7.6)     build-depends: ghc-prim@@ -134,7 +137,7 @@   main-is:          Inspection.hs   build-depends:       base-    , inspection-testing  >=0.4.1.1 && <0.5+    , inspection-testing  >=0.4.1.1 && <0.6     , postgresql-libpq     , postgresql-simple     , tasty
src/Database/PostgreSQL/Simple.hs view
@@ -73,6 +73,7 @@     , Base.connectPostgreSQL     , Base.close     , Base.connect+    , Base.withConnect     , Base.ConnectInfo(..)     , Base.defaultConnectInfo     , Base.postgreSQLConnectionString@@ -900,7 +901,7 @@ --   all values of the given PostgreSQL type is considered \"compatible\". --   For instance, you can always extract a PostgreSQL 16-bit @SMALLINT@ --   column to a Haskell 'Int'.  The Haskell 'Float' type can accurately---   represent a @SMALLINT@, so it is considered compatble with those types.+--   represent a @SMALLINT@, so it is considered compatible with those types. -- -- * A numeric compatibility check is based only on the type of a --   column, /not/ on its values. For instance, a PostgreSQL 64-bit
src/Database/PostgreSQL/Simple/Copy.hs view
@@ -55,7 +55,7 @@ -- | Issue a @COPY FROM STDIN@ or @COPY TO STDOUT@ query.   In the former --   case, the connection's state will change to @CopyIn@;  in the latter, --   @CopyOut@.  The connection must be in the ready state in order---   to call this function.  Performs parameter subsitution.+--   to call this function.  Performs parameter substitution.  copy :: ( ToRow params ) => Connection -> Query -> params -> IO () copy conn template qs = do
src/Database/PostgreSQL/Simple/Errors.hs view
@@ -64,7 +64,7 @@   -- | Tries to convert 'SqlError' to 'ConstrainViolation', checks sqlState and--- succeedes only if able to parse sqlErrorMsg.+-- succeeds only if able to parse sqlErrorMsg. -- -- > createUser = handleJust constraintViolation handler $ execute conn ... -- >   where
src/Database/PostgreSQL/Simple/Internal.hs view
@@ -155,6 +155,12 @@ connect :: ConnectInfo -> IO Connection connect = connectPostgreSQL . postgreSQLConnectionString +-- | Memory bracket around 'connect' and 'close'.+--+-- @since 0.6.5+withConnect :: ConnectInfo -> (Connection -> IO c) -> IO c+withConnect connInfo = bracket (connect connInfo) close+ -- | Attempt to make a connection based on a libpq connection string. --   See <https://www.postgresql.org/docs/9.5/static/libpq-connect.html#LIBPQ-CONNSTRING> --   for more information.  Also note that environment variables also affect
src/Database/PostgreSQL/Simple/ToField.hs view
@@ -318,14 +318,13 @@ instance ToField JSON.Value where     toField = toField . JSON.encode --- | Convert a Haskell value to a JSON 'JSON.Value' using--- 'JSON.toJSON' and convert that to a field using 'toField'.+-- | Convert a Haskell value to JSON using 'JSON.toEncoding'. -- -- This can be used as the default implementation for the 'toField' -- method for Haskell types that have a JSON representation in -- PostgreSQL. toJSONField :: JSON.ToJSON a => a -> Action-toJSONField = toField . JSON.toJSON+toJSONField = toField . JSON.encode  -- | Surround a string with single-quote characters: \"@'@\" --
test/Main.hs view
@@ -137,7 +137,7 @@         xs <- readIORef ref         writeIORef ref $! (a,b):xs     xs <- readIORef ref-    reverse xs @?= [(a,b) | a <- [1..100], b <- [1..50]]+    reverse xs @?= [(a,b) | b <- [1..50], a <- [1..100]]      -- Make sure fold propagates our exception.     ref <- newIORef []@@ -472,12 +472,13 @@  goldenTest :: TestName -> IO BL.ByteString -> TestTree goldenTest testName =-    goldenVsString testName (resultsDir </> fileName<.>"expected")+    goldenVsStringDiff testName diff (resultsDir </> fileName<.>"expected")   where     resultsDir = "test" </> "results"     fileName = map normalize testName     normalize c | not (isAlpha c) = '-'                 | otherwise       = c+    diff ref new = ["diff", "-u", ref, new]  -- | Test that we provide a sensible error message on failure testCopyUniqueConstraintError :: TestEnv -> TestTree
test/results/malformed-input.expected view
@@ -1,4 +1,4 @@ user error (Database.PostgreSQL.Simple.Copy.putCopyEnd: failed to parse command status-Connection error: ERROR:  invalid input syntax for integer: "z"+Connection error: ERROR:  invalid input syntax for type integer: "z" CONTEXT:  COPY copy_unique_constraint_error_test, line 3, column x: "z" )