Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 26 lines (20 sloc) 757 Bytes
module Turbinado.Environment.Database (
addDatabaseToEnvironment
) where
import Data.Typeable
import Data.Dynamic
import qualified Data.Map as M
import Control.Monad
import Control.Monad.State
import Control.Monad.Trans
import Data.Maybe
import Database.HDBC
import Config.Master
import Turbinado.Controller.Monad
import Turbinado.Environment.Types
addDatabaseToEnvironment :: (HasEnvironment m) => m ()
addDatabaseToEnvironment = do e <- getEnvironment
case databaseConnection of
Nothing -> return ()
Just conn -> do c <- liftIO conn
setEnvironment $ e {getDatabase = Just (ConnWrapper c)}