-
Notifications
You must be signed in to change notification settings - Fork 0
/
Controller.hs
executable file
·89 lines (76 loc) · 2.64 KB
/
Controller.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
module Turbinado.Controller (
-- limited export from Turbinado.Controller.Monad
Controller,
runController,
-- * Functions
liftIO, catch,
redirectTo,
-- * Database
--quickQuery,
--quickQuery',
--run,
HDBC.SqlValue(..),
HDBC.toSql,
HDBC.fromSql,
HDBC.safeFromSql,
HDBC.nToSql,
HDBC.iToSql,
HDBC.posixToSql,
module Data.Maybe,
module Config.Master,
module Turbinado.Environment.CodeStore,
module Turbinado.Environment.Cookie,
module Turbinado.Environment.Header,
module Turbinado.Environment.Logger,
module Turbinado.Environment.Params,
module Turbinado.Environment.Request,
module Turbinado.Environment.Response,
module Turbinado.Environment.Settings,
module Turbinado.Environment.Types,
module Turbinado.Environment.ViewData
) where
import Control.OldException (catchDyn)
import Control.Monad
import Control.Monad.State
import Control.Monad.Trans (MonadIO(..))
import Data.Maybe
import qualified Network.HTTP as HTTP
import Prelude hiding (catch)
import qualified Database.HDBC as HDBC
import Config.Master
import Turbinado.Environment.CodeStore
import Turbinado.Environment.Cookie
import Turbinado.Environment.Database
import Turbinado.Environment.Header
import Turbinado.Environment.Logger
import Turbinado.Environment.Params
import Turbinado.Environment.Request
import Turbinado.Environment.Response
import Turbinado.Environment.Settings
import Turbinado.Environment.Types
import Turbinado.Environment.ViewData
import Turbinado.Controller.Monad
import Turbinado.Utility.General
import Turbinado.Server.StandardResponse
-- evalController :: Controller () -> Environment -> IO Environment
-- evalController p = runController p e
--
-- * Helper functions
--
redirectTo :: String -> Controller ()
redirectTo l = redirectResponse l
--
-- * Database functions
--
--quickQuery :: String -> [HDBC.SqlValue] -> Controller [[HDBC.SqlValue]]
--quickQuery s vs = do e <- get
-- let c = fromJust $ getDatabase e
-- liftIO $ HDBC.handleSqlError $ HDBC.quickQuery c s vs
--quickQuery' :: String -> [HDBC.SqlValue] -> Controller [[HDBC.SqlValue]]
--quickQuery' s vs = do e <- get
-- let c = fromJust $ getDatabase e
-- liftIO $ HDBC.handleSqlError $ HDBC.quickQuery' c s vs
--run :: String -> [HDBC.SqlValue] -> Controller Integer
--run s vs = do e <- get
-- let c = fromJust $ getDatabase e
-- liftIO $ HDBC.handleSqlError $ HDBC.run c s vs