equal
deleted
inserted
replaced
8 import Database.HDBC.MySQL |
8 import Database.HDBC.MySQL |
9 import System.IO |
9 import System.IO |
10 import Control.Concurrent |
10 import Control.Concurrent |
11 import Control.Exception |
11 import Control.Exception |
12 import Monad |
12 import Monad |
|
13 import Maybe |
13 ------------------------ |
14 ------------------------ |
14 import CoreTypes |
15 import CoreTypes |
15 |
16 |
16 dbInteractionLoop queries dbConn = do |
17 dbInteractionLoop queries dbConn = do |
17 q <- readChan queries |
18 q <- readChan queries |
18 case q of |
19 case q of |
19 HasRegistered queryStr -> putStrLn queryStr |
20 HasRegistered name -> do |
|
21 statement <- prepare dbConn "SELECT uid FROM users WHERE name=?" |
|
22 execute statement [SqlString name] |
|
23 uid <- fetchRow statement |
|
24 finish statement |
|
25 putStrLn (show $ isJust uid) |
20 CheckPassword queryStr -> putStrLn queryStr |
26 CheckPassword queryStr -> putStrLn queryStr |
21 |
27 |
22 dbInteractionLoop queries dbConn |
28 dbInteractionLoop queries dbConn |
23 |
29 |
24 dbConnectionLoop serverInfo = do |
30 dbConnectionLoop serverInfo = do |