selda-postgresql 0.1.7.0 → 0.1.7.1
raw patch · 3 files changed
+14/−9 lines, 3 filesdep ~exceptionsdep ~seldaPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: exceptions, selda
API changes (from Hackage documentation)
Files
- selda-postgresql.cabal +2/−2
- src/Database/Selda/PostgreSQL.hs +8/−2
- src/Database/Selda/PostgreSQL/Encoding.hs +4/−5
selda-postgresql.cabal view
@@ -1,5 +1,5 @@ name: selda-postgresql-version: 0.1.7.0+version: 0.1.7.1 synopsis: PostgreSQL backend for the Selda database EDSL. description: PostgreSQL backend for the Selda database EDSL. Requires the PostgreSQL @libpq@ development libraries to be@@ -31,7 +31,7 @@ base >=4.8 && <5 , bytestring >=0.9 && <0.11 , exceptions >=0.8 && <0.9- , selda >=0.1.10.0 && <0.2+ , selda >=0.1.12 && <0.2 , text >=1.0 && <1.3 if !flag(haste) build-depends:
src/Database/Selda/PostgreSQL.hs view
@@ -110,7 +110,7 @@ case st of ConnectionOk -> do let backend = pgBackend conn- liftIO $ runStmt backend "SET client_min_messages TO WARNING;" []+ _ <- liftIO $ runStmt backend "SET client_min_messages TO WARNING;" [] newConnection backend (decodeUtf8 connStr) nope -> do connFailed nope@@ -130,6 +130,7 @@ , backendId = PostgreSQL , ppConfig = defPPConfig { ppType = pgColType defPPConfig+ , ppTypePK = pgColTypePK defPPConfig , ppAutoIncInsert = "DEFAULT" , ppColAttrs = ppColAttrs defPPConfig . filter (/= AutoIncrement) }@@ -223,10 +224,15 @@ -- | Custom column types for postgres. pgColType :: PPConfig -> SqlTypeRep -> T.Text-pgColType _ TRowID = "BIGSERIAL"+pgColType _ TRowID = "BIGINT" pgColType _ TInt = "INT8" pgColType _ TFloat = "FLOAT8" pgColType _ TDateTime = "TIMESTAMP" pgColType _ TBlob = "BYTEA" pgColType cfg t = ppType cfg t++-- | Custom column types (primary key position) for postgres.+pgColTypePK :: PPConfig -> SqlTypeRep -> T.Text+pgColTypePK _ TRowID = "BIGSERIAL"+pgColTypePK cfg t = pgColType cfg t #endif
src/Database/Selda/PostgreSQL/Encoding.hs view
@@ -14,7 +14,6 @@ #else -import Control.Exception (throw) import qualified Data.ByteString as BS import Data.ByteString.Builder import Data.ByteString.Char8 (unpack)@@ -79,13 +78,13 @@ | otherwise = error $ "bad blob string from postgres: " ++ show s where- hex n s =- case BS.index s n of+ hex n x =+ case BS.index x n of c | c >= 97 -> c - 87 -- c >= 'a' | c >= 65 -> c - 55 -- c >= 'A' | otherwise -> c - 48 -- c is numeric- go s- | BS.length s >= 2 = (16*hex 0 s + (hex 1 s)) : go (BS.drop 2 s)+ go x+ | BS.length x >= 2 = (16*hex 0 x + (hex 1 x)) : go (BS.drop 2 x) | otherwise = [] textish = [textType, timestampType, timeType, dateType] readBool "f" = False