| Copyright | Copyright (C) 2017 Johannes Hartmann |
|---|---|
| License | MIT |
| Maintainer | Johannes Hartmann <ec17512@qmul.ac.uk> |
| Stability | stable |
| Portability | portable |
| Safe Haskell | None |
DataBaseModule
Description
This module handles all database related parts of the application.
Written by Johannes Hartmann
- dbConnect :: IO Connection
- initialiseDB :: Connection -> IO ()
- clearDatabase :: Connection -> IO ()
- cleanupDatabase :: Connection -> String -> IO ()
- disconnectDB :: Connection -> IO ()
- insertMovieIntoDB :: Connection -> [Movie] -> IO ()
- insertActorIntoDB :: Connection -> [Actor] -> IO ()
- searchMoviesInDB :: Connection -> String -> IO (Maybe [Movie])
- getMoviesFromDatabase :: Connection -> IO [Movie]
- getActorsFromDatabase :: Connection -> IO [Actor]
- getDateOfLastMoveInDB :: Connection -> IO (Maybe String)
Documentation
initialiseDB :: Connection -> IO () Source #
Given a connection to a database this function creates all the necessary tables if they don't already exist
clearDatabase :: Connection -> IO () Source #
drops all tables in the database
cleanupDatabase :: Connection -> String -> IO () Source #
removes all movies before a given date and deals with inconsistent states in the database after the deletion of a movie
disconnectDB :: Connection -> IO () Source #
Closes the database connection
insertMovieIntoDB :: Connection -> [Movie] -> IO () Source #
Inserts a given list of movies into the movies table
insertActorIntoDB :: Connection -> [Actor] -> IO () Source #
Inserts a given list of actors into the actors table and fills the plays relation table with all actor-movie connections
searchMoviesInDB :: Connection -> String -> IO (Maybe [Movie]) Source #
Looks up all movies a given actor plays in and returns a maybe list of movies. The Maybe will return Nothing if there is no movie for a given actor
getMoviesFromDatabase :: Connection -> IO [Movie] Source #
looks up all movies in the database and returns a list of all actors
getActorsFromDatabase :: Connection -> IO [Actor] Source #
looks up all actors in the database and returns a list of all actors
getDateOfLastMoveInDB :: Connection -> IO (Maybe String) Source #
returns the date of the newest movie in the Database