packages feed

haskelldb-hdbc 0.10 → 0.12

raw patch · 2 files changed

+38/−33 lines, 2 filesdep +containersdep +convertibledep +old-timedep −haskell98dep ~HDBCdep ~basedep ~haskelldbnew-uploader

Dependencies added: containers, convertible, old-time

Dependencies removed: haskell98

Dependency ranges changed: HDBC, base, haskelldb

Files

Database/HaskellDB/HDBC.hs view
@@ -31,10 +31,10 @@ import qualified Data.Map as Map import Data.Maybe (fromMaybe) --- | Run an action on a HDBC Connection and close the connection.-hdbcConnect :: MonadIO m => +-- | Run an action on a HDBC IConnection and close the connection.+hdbcConnect :: (MonadIO m, IConnection conn) =>                 SqlGenerator-            -> IO Connection -- ^ connection function+            -> IO conn -- ^ connection function 	    -> (Database -> m a) -> m a hdbcConnect gen connect action =      do@@ -45,7 +45,7 @@     liftIO $ handleSqlError (HDBC.disconnect conn)     return x -mkDatabase :: SqlGenerator -> Connection -> Database+mkDatabase :: (IConnection conn) => SqlGenerator -> conn -> Database mkDatabase gen connection     = Database { dbQuery	= hdbcQuery       gen connection,     		 dbInsert	= hdbcInsert      gen connection,@@ -61,9 +61,9 @@ 		 dbDropTable    = hdbcDropTable   gen connection 	       } -hdbcQuery :: GetRec er vr => +hdbcQuery :: (GetRec er vr, IConnection conn) =>  	     SqlGenerator-          -> Connection +          -> conn 	  -> PrimQuery  	  -> Rel er  	  -> IO [Record vr]@@ -71,26 +71,26 @@     where sql = show $ ppSql $ sqlQuery gen q           scheme = attributes q -hdbcInsert :: SqlGenerator -> Connection -> TableName -> Assoc -> IO ()+hdbcInsert :: (IConnection conn) => SqlGenerator -> conn -> TableName -> Assoc -> IO () hdbcInsert gen conn table assoc =      hdbcPrimExecute conn $ show $ ppInsert $ sqlInsert gen table assoc -hdbcInsertQuery :: SqlGenerator -> Connection -> TableName -> PrimQuery -> IO ()+hdbcInsertQuery :: (IConnection conn) => SqlGenerator -> conn -> TableName -> PrimQuery -> IO () hdbcInsertQuery gen conn table assoc =      hdbcPrimExecute conn $ show $ ppInsert $ sqlInsertQuery gen table assoc -hdbcDelete :: SqlGenerator -> Connection -> TableName -> [PrimExpr] -> IO ()+hdbcDelete :: (IConnection conn) => SqlGenerator -> conn -> TableName -> [PrimExpr] -> IO () hdbcDelete gen conn table exprs =      hdbcPrimExecute conn $ show $ ppDelete $ sqlDelete gen table exprs -hdbcUpdate :: SqlGenerator -> Connection -> TableName -> [PrimExpr] -> Assoc -> IO ()+hdbcUpdate :: (IConnection conn) => SqlGenerator -> conn -> TableName -> [PrimExpr] -> Assoc -> IO () hdbcUpdate gen conn table criteria assigns =      hdbcPrimExecute conn $ show $ ppUpdate $ sqlUpdate gen table criteria assigns -hdbcTables :: Connection -> IO [TableName]+hdbcTables :: (IConnection conn) => conn -> IO [TableName] hdbcTables conn = handleSqlError $ HDBC.getTables conn -hdbcDescribe :: Connection -> TableName -> IO [(Attribute,FieldDesc)]+hdbcDescribe :: (IConnection conn) => conn -> TableName -> IO [(Attribute,FieldDesc)] hdbcDescribe conn table =      handleSqlError $ do                      cs <- HDBC.describeTable conn table@@ -130,24 +130,24 @@             SqlGUIDT          -> string             SqlUnknownT _     -> string -hdbcCreateDB :: SqlGenerator -> Connection -> String -> IO ()+hdbcCreateDB :: (IConnection conn) => SqlGenerator -> conn -> String -> IO () hdbcCreateDB gen conn name      = hdbcPrimExecute conn $ show $ ppCreate $ sqlCreateDB gen name -hdbcCreateTable :: SqlGenerator -> Connection -> TableName -> [(Attribute,FieldDesc)] -> IO ()+hdbcCreateTable :: (IConnection conn) => SqlGenerator -> conn -> TableName -> [(Attribute,FieldDesc)] -> IO () hdbcCreateTable gen conn name attrs     = hdbcPrimExecute conn $ show $ ppCreate $ sqlCreateTable gen name attrs -hdbcDropDB :: SqlGenerator -> Connection -> String -> IO ()+hdbcDropDB :: (IConnection conn) => SqlGenerator -> conn -> String -> IO () hdbcDropDB gen conn name      = hdbcPrimExecute conn $ show $ ppDrop $ sqlDropDB gen name -hdbcDropTable :: SqlGenerator -> Connection -> TableName -> IO ()+hdbcDropTable :: (IConnection conn) => SqlGenerator -> conn -> TableName -> IO () hdbcDropTable gen conn name     = hdbcPrimExecute conn $ show $ ppDrop $ sqlDropTable gen name  -- | HDBC implementation of 'Database.dbTransaction'.-hdbcTransaction :: Connection -> IO a -> IO a+hdbcTransaction :: (IConnection conn) => conn -> IO a -> IO a hdbcTransaction conn action =      handleSqlError $ HDBC.withTransaction conn (\_ -> action) @@ -159,8 +159,8 @@ type HDBCRow = Map String HDBC.SqlValue  -- | Primitive query-hdbcPrimQuery :: GetRec er vr => -		 Connection -- ^ Database connection.+hdbcPrimQuery :: (GetRec er vr, IConnection conn) => +		 conn -- ^ Database connection. 	      -> String     -- ^ SQL query 	      -> Scheme     -- ^ List of field names to retrieve 	      -> Rel er     -- ^ Phantom argument to get the return type right.@@ -173,7 +173,7 @@     mapM (getRec hdbcGetInstances rel scheme) rows  -- | Primitive execute-hdbcPrimExecute :: Connection -- ^ Database connection.+hdbcPrimExecute :: (IConnection conn) => conn -- ^ Database connection. 		-> String     -- ^ SQL query. 		-> IO () hdbcPrimExecute conn sql = @@ -197,7 +197,8 @@ 		 , getCalendarTime = hdbcGetValue 		 } -hdbcGetValue :: SqlType a => HDBCRow -> String -> IO (Maybe a)+-- hdbcGetValue :: Data.Convertible.Base.Convertible SqlValue a+--             => HDBCRow -> String -> IO (Maybe a) hdbcGetValue m f = case Map.lookup (map toLower f) m of                      Nothing -> fail $ "No such field " ++ f                      Just x  -> return $ HDBC.fromSql x
haskelldb-hdbc.cabal view
@@ -1,21 +1,25 @@ Name: haskelldb-hdbc-Version: 0.10+Version: 0.12+Cabal-version: >= 1.2+Build-type: Simple Copyright: The authors 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-build-depends: -  haskell98,-  base,-  mtl,-  haskelldb==0.10,-  HDBC==1.0.1-Extensions: ExistentialQuantification,+Synopsis: HaskellDB support for HDBC. You will also need one+          or more back-end specific packages.++Flag split-base++Library+  Build-depends: mtl, haskelldb>=0.12, HDBC>=2.0.0 && < 2.2.0, convertible >= 1.0.1+  if flag(split-base)+    Build-depends: base >= 3.0, containers, old-time+  else+    Build-depends: base < 3.0+  Extensions: ExistentialQuantification,             OverlappingInstances,             UndecidableInstances,             MultiParamTypeClasses-Synopsis: HaskellDB support for HDBC. You will also need one-          or more back-end specific packages.-Exposed-Modules:+  Exposed-Modules:         Database.HaskellDB.HDBC-ghc-options: -O2