Remove erroneous parens around columns in SELECT statement
These were causing runtime errors... whoops!
This commit is contained in:
parent
6ecab8c3a6
commit
8ebc89b44b
5 changed files with 8 additions and 8 deletions
|
@ -37,7 +37,7 @@ delete dbFile username = withConnection dbFile $ \conn -> do
|
|||
-- | Attempt to find `username` in the Account table of `dbFile`.
|
||||
lookup :: FilePath -> T.Username -> IO (Maybe T.Account)
|
||||
lookup dbFile username = withConnection dbFile $ \conn -> do
|
||||
res <- query conn "SELECT (username,password,email,role,profilePicture) FROM Accounts WHERE username = ?" (Only username)
|
||||
res <- query conn "SELECT username,password,email,role,profilePicture FROM Accounts WHERE username = ?" (Only username)
|
||||
case res of
|
||||
[x] -> pure (Just x)
|
||||
_ -> pure Nothing
|
||||
|
@ -45,5 +45,5 @@ lookup dbFile username = withConnection dbFile $ \conn -> do
|
|||
-- | Return a list of accounts with the sensitive data removed.
|
||||
list :: FilePath -> IO [T.User]
|
||||
list dbFile = withConnection dbFile $ \conn -> do
|
||||
accounts <- query_ conn "SELECT (username,password,email,role,profilePicture) FROM Accounts"
|
||||
accounts <- query_ conn "SELECT username,password,email,role,profilePicture FROM Accounts"
|
||||
pure $ T.userFromAccount <$> accounts
|
||||
|
|
|
@ -17,7 +17,7 @@ reset dbFile username = withConnection dbFile $ \conn ->
|
|||
-- `username`. Returns a Maybe in case `username` doesn't exist.
|
||||
forUsername :: FilePath -> T.Username -> IO (Maybe Integer)
|
||||
forUsername dbFile username = withConnection dbFile $ \conn -> do
|
||||
res <- query conn "SELECT (numAttempts) FROM LoginAttempts WHERE username = ?"
|
||||
res <- query conn "SELECT username,numAttempts FROM LoginAttempts WHERE username = ?"
|
||||
(Only username)
|
||||
case res of
|
||||
[T.LoginAttempt{..}] -> pure (Just loginAttemptNumAttempts)
|
||||
|
|
|
@ -22,7 +22,7 @@ create dbFile secret username password role email = withConnection dbFile $ \con
|
|||
|
||||
get :: FilePath -> T.Username -> IO (Maybe T.PendingAccount)
|
||||
get dbFile username = withConnection dbFile $ \conn -> do
|
||||
res <- query conn "SELECT (secret,username,password,role,email) FROM PendingAccounts WHERE username = ?" (Only username)
|
||||
res <- query conn "SELECT secret,username,password,role,email FROM PendingAccounts WHERE username = ?" (Only username)
|
||||
case res of
|
||||
[x] -> pure (Just x)
|
||||
_ -> pure Nothing
|
||||
|
|
|
@ -20,7 +20,7 @@ isValid session = do
|
|||
-- | Lookup the session by UUID.
|
||||
get :: FilePath -> T.SessionUUID -> IO (Maybe T.StoredSession)
|
||||
get dbFile uuid = withConnection dbFile $ \conn -> do
|
||||
res <- query conn "SELECT (uuid,username,tsCreated) FROM Sessions WHERE uuid = ?" (Only uuid)
|
||||
res <- query conn "SELECT uuid,username,tsCreated FROM Sessions WHERE uuid = ?" (Only uuid)
|
||||
case res of
|
||||
[x] -> pure (Just x)
|
||||
_ -> pure Nothing
|
||||
|
@ -28,7 +28,7 @@ get dbFile uuid = withConnection dbFile $ \conn -> do
|
|||
-- | Lookup the session stored under `username` in `dbFile`.
|
||||
find :: FilePath -> T.Username -> IO (Maybe T.StoredSession)
|
||||
find dbFile username = withConnection dbFile $ \conn -> do
|
||||
res <- query conn "SELECT (uuid,username,tsCreated) FROM Sessions WHERE username = ?" (Only username)
|
||||
res <- query conn "SELECT uuid,username,tsCreated FROM Sessions WHERE username = ?" (Only username)
|
||||
case res of
|
||||
[x] -> pure (Just x)
|
||||
_ -> pure Nothing
|
||||
|
@ -71,4 +71,4 @@ findOrCreate dbFile account = withConnection dbFile $ \conn ->
|
|||
-- | Return a list of all sessions in the Sessions table.
|
||||
list :: FilePath -> IO [T.StoredSession]
|
||||
list dbFile = withConnection dbFile $ \conn ->
|
||||
query_ conn "SELECT (uuid,username,tsCreated) FROM Sessions"
|
||||
query_ conn "SELECT uuid,username,tsCreated FROM Sessions"
|
||||
|
|
|
@ -24,4 +24,4 @@ delete dbFile tripPK =
|
|||
-- | Return a list of all of the trips in `dbFile`.
|
||||
list :: FilePath -> IO [T.Trip]
|
||||
list dbFile = withConnection dbFile $ \conn ->
|
||||
query_ conn "SELECT (username,destination,startDate,endDate,comment) FROM Trips"
|
||||
query_ conn "SELECT username,destination,startDate,endDate,comment FROM Trips"
|
||||
|
|
Loading…
Reference in a new issue