packages feed

DSH 0.6 → 0.6.1

raw patch · 4 files changed

+22/−5 lines, 4 files

Files

DSH.cabal view
@@ -1,5 +1,5 @@ Name:                DSH-Version:             0.6+Version:             0.6.1 Synopsis:            Database Supported Haskell Description:   This is a Haskell library for database-supported program execution. Using
src/Database/DSH/Combinators.hs view
@@ -336,9 +336,9 @@  -- 'QA', 'TA' and 'View' instances for tuples up to the defined length. -$(generateDeriveTupleQARange   3 8)-$(generateDeriveTupleTARange   3 8)-$(generateDeriveTupleViewRange 3 8)+$(generateDeriveTupleQARange   3 12)+$(generateDeriveTupleTARange   3 12)+$(generateDeriveTupleViewRange 3 12)   -- * Missing Combinators
src/Database/DSH/Compile.hs view
@@ -13,12 +13,25 @@ import Control.Monad.Reader import Control.Exception (evaluate) +import Control.Concurrent.MVar+import System.IO.Unsafe (unsafePerformIO)+ import qualified Text.XML.HaXml as X import Text.XML.HaXml (Content(..), AttValue(..), tag, deep, children, xmlParse, Document(..))  import Database.HDBC import Data.Convertible ++-- | This is a global synchronisation variable used to gouard calls to the+-- Pathfinder C library. The C library appears not to be thread safe and this+-- variable is used to make sure that only one pathfinder call is made at time+-- even when a number parallel calls are made to the DSH's fromQ query+-- evaluator.+{-# NOINLINE globalMVar #-}+globalMVar :: MVar ()+globalMVar = unsafePerformIO (newEmptyMVar)+ -- | Wrapper type with phantom type for algebraic plan -- The type variable represents the type of the result of the plan newtype AlgebraXML a = Algebra String@@ -55,7 +68,9 @@  algToAlg :: AlgebraXML a -> IO (AlgebraXML a) algToAlg (Algebra s) = do+                        putMVar  globalMVar ()                         r <- pathfinder s [] OutputXml+                        takeMVar globalMVar                         case r of                            (Right sql) -> return $ Algebra sql                            (Left err) -> error $ "Pathfinder compilation for input: \n"@@ -65,7 +80,9 @@ -- | Translate an algebraic plan into SQL code using Pathfinder algToSQL :: AlgebraXML a -> IO (SQLXML a) algToSQL (Algebra s) = do+                         putMVar  globalMVar ()                          r <- pathfinder s [] OutputSql+                         takeMVar globalMVar                          case r of                             (Right sql) -> return $ SQL sql                             (Left err) -> error $ "Pathfinder compilation for input: \n"
tests/Main.hs view
@@ -28,7 +28,7 @@   arbitrary = fmap Text.pack arbitrary  getConn :: IO Connection-getConn = connectPostgreSQL "user = 'postgres' password = 'haskell98' host = 'localhost' dbname = 'ferry'"+getConn = connectPostgreSQL "user = 'giorgidz' password = '' host = 'localhost' dbname = 'giorgidz'"  qc:: Testable prop => prop -> IO () qc = quickCheckWith stdArgs{maxSuccess = 100, maxSize = 5}