Skip to content

Commit

Permalink
Callout the use of runDBAction.
Browse files Browse the repository at this point in the history
This is a naive attempt at qfpl#85, since it is easy to miss the reference to catching the
possible exceptions from the SQLite functions.
  • Loading branch information
mankyKitty committed Sep 11, 2019
1 parent 59cb74d commit ef287f1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Level04/DB.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import Database.SQLite.SimpleErrors.Types (SQLiteResponse)
import Level04.Types (Comment, CommentText,
Error, Topic)

-- ------------------------------------------------------------------------|
-- You'll need the documentation for sqlite-simple ready for this section! |
-- ------------------------------------------------------------------------|
-- ------------------------------------------------------------------------------|
-- You'll need the documentation for sqlite-simple & sqlite-simple-errors handy! |
-- ------------------------------------------------------------------------------|

-- We have a data type to simplify passing around the information we need to run
-- our database queries. This also allows things to change over time without
Expand All @@ -53,7 +53,7 @@ initDB
:: FilePath
-> IO ( Either SQLiteResponse FirstAppDB )
initDB fp =
error "initDB not implemented"
error "initDB not implemented (use Sql.runDBAction to catch exceptions)"
where
-- Query has an `IsString` instance so string literals like this can be
-- converted into a `Query` type when the `OverloadedStrings` language
Expand Down Expand Up @@ -82,7 +82,7 @@ getComments =
-- cannot be converted to a Comment, or simply ignoring any DBComment that is
-- not valid.
in
error "getComments not implemented"
error "getComments not implemented (use Sql.runDBAction to catch exceptions)"

addCommentToTopic
:: FirstAppDB
Expand All @@ -93,7 +93,7 @@ addCommentToTopic =
let
sql = "INSERT INTO comments (topic,comment,time) VALUES (?,?,?)"
in
error "addCommentToTopic not implemented"
error "addCommentToTopic not implemented (use Sql.runDBAction to catch exceptions)"

getTopics
:: FirstAppDB
Expand All @@ -102,7 +102,7 @@ getTopics =
let
sql = "SELECT DISTINCT topic FROM comments"
in
error "getTopics not implemented"
error "getTopics not implemented (use Sql.runDBAction to catch exceptions)"

deleteTopic
:: FirstAppDB
Expand All @@ -112,4 +112,4 @@ deleteTopic =
let
sql = "DELETE FROM comments WHERE topic = ?"
in
error "deleteTopic not implemented"
error "deleteTopic not implemented (use Sql.runDBAction to catch exceptions)"

0 comments on commit ef287f1

Please sign in to comment.