haskelldb-hdbc 2.1.0 → 2.2.1
raw patch · 2 files changed
+19/−9 lines, 2 filesdep ~haskelldbPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: haskelldb
API changes (from Hackage documentation)
Files
- Database/HaskellDB/HDBC.hs +14/−4
- haskelldb-hdbc.cabal +5/−5
Database/HaskellDB/HDBC.hs view
@@ -55,6 +55,7 @@ dbTables = hdbcTables connection, dbDescribe = hdbcDescribe connection, dbTransaction = hdbcTransaction connection,+ dbCommit = HDBC.commit connection, dbCreateDB = hdbcCreateDB gen connection, dbCreateTable = hdbcCreateTable gen connection, dbDropDB = hdbcDropDB gen connection,@@ -123,7 +124,7 @@ SqlLongVarBinaryT -> string SqlDateT -> CalendarTimeT SqlTimeT -> CalendarTimeT- SqlTimestampT -> CalendarTimeT+ SqlTimestampT -> LocalTimeT SqlUTCDateTimeT -> CalendarTimeT SqlUTCTimeT -> CalendarTimeT SqlTimeWithZoneT -> CalendarTimeT@@ -160,6 +161,9 @@ type HDBCRow = Map String HDBC.SqlValue +normalizeField :: String -> String+normalizeField = map toLower+ -- | Primitive query hdbcPrimQuery :: (GetRec er vr, IConnection conn) => conn -- ^ Database connection.@@ -171,8 +175,13 @@ do stmt <- handleSqlError $ HDBC.prepare conn sql handleSqlError $ HDBC.execute stmt []- rows <- HDBC.fetchAllRowsMap stmt- mapM (getRec hdbcGetInstances rel scheme) rows+ rows <- fetchNormalizedAllRowsAL stmt+ mapM (getRec hdbcGetInstances rel scheme) $ map Map.fromList rows+ where fetchNormalizedAllRowsAL sth =+ do+ names <- map normalizeField `fmap` getColumnNames sth+ rows <- fetchAllRows sth+ return $ map (zip names) rows -- | Primitive execute hdbcPrimExecute :: (IConnection conn) => conn -- ^ Database connection.@@ -197,10 +206,11 @@ , getDouble = hdbcGetValue , getBool = hdbcGetValue , getCalendarTime = hdbcGetValue+ , getLocalTime = hdbcGetValue } -- hdbcGetValue :: Data.Convertible.Base.Convertible SqlValue a -- => HDBCRow -> String -> IO (Maybe a)-hdbcGetValue m f = case Map.lookup (map toLower f) m of+hdbcGetValue m f = case Map.lookup (normalizeField f) m of Nothing -> fail $ "No such field " ++ f Just x -> return $ HDBC.fromSql x
haskelldb-hdbc.cabal view
@@ -1,9 +1,9 @@ Name: haskelldb-hdbc-Version: 2.1.0+Version: 2.2.1 Cabal-version: >= 1.6 Build-type: Simple Copyright: The authors-Homepage: http://trac.haskell.org/haskelldb+Homepage: https://github.com/m4dc4p/haskelldb Maintainer: haskelldb-users@lists.sourceforge.net Author: Daan Leijen, Conny Andersson, Martin Andersson, Mary Bergman, Victor Blomqvist, Bjorn Bringert, Anders Hockersten, Torbjorn Martin, Jeremy Shaw License: BSD3@@ -13,7 +13,7 @@ Category: Database Library- Build-depends: mtl >= 1 && < 2.1, haskelldb >= 2 && < 3, HDBC >= 2 && < 3, convertible >= 1.0.1 && < 2+ Build-depends: mtl >= 1 && < 2.1, haskelldb >= 2.2 && < 3, HDBC >= 2 && < 3, convertible >= 1.0.1 && < 2 Build-depends: base >= 3 && < 5, containers >= 0.2 && < 1, old-time >= 1 && < 2 Extensions: ExistentialQuantification, OverlappingInstances,@@ -24,5 +24,5 @@ ghc-options: -fwarn-incomplete-patterns Source-repository head- Type: darcs- Location: http://code.haskell.org/haskelldb+ Type: git+ Location: https://github.com/m4dc4p/haskelldb