diff options
author | William Carroll <wpcarro@gmail.com> | 2020-07-30T18·52+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-07-30T18·52+0100 |
commit | 8ebc89b44b3fc0e6025b33a3e7ec37e9ebb385cc (patch) | |
tree | 07b7cd08675ff19f371d5ce078c1c6f916fb80b1 /src | |
parent | 6ecab8c3a625d58fa5c4c5daf62a6567b4fc7701 (diff) |
Remove erroneous parens around columns in SELECT statement
These were causing runtime errors... whoops!
Diffstat (limited to 'src')
-rw-r--r-- | src/Accounts.hs | 4 | ||||
-rw-r--r-- | src/LoginAttempts.hs | 2 | ||||
-rw-r--r-- | src/PendingAccounts.hs | 2 | ||||
-rw-r--r-- | src/Sessions.hs | 6 | ||||
-rw-r--r-- | src/Trips.hs | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/src/Accounts.hs b/src/Accounts.hs index e8865baa99f6..c7ab7a2f135f 100644 --- a/src/Accounts.hs +++ b/src/Accounts.hs @@ -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 diff --git a/src/LoginAttempts.hs b/src/LoginAttempts.hs index a7e950da7412..f5a5bde6a004 100644 --- a/src/LoginAttempts.hs +++ b/src/LoginAttempts.hs @@ -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) diff --git a/src/PendingAccounts.hs b/src/PendingAccounts.hs index 412f02ad8885..a555185fa717 100644 --- a/src/PendingAccounts.hs +++ b/src/PendingAccounts.hs @@ -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 diff --git a/src/Sessions.hs b/src/Sessions.hs index 054495e05ca6..f5b2f6f41000 100644 --- a/src/Sessions.hs +++ b/src/Sessions.hs @@ -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" diff --git a/src/Trips.hs b/src/Trips.hs index a7880b503ddd..55bc6b958d0f 100644 --- a/src/Trips.hs +++ b/src/Trips.hs @@ -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" |