Commit 6d6fb13a authored by Michael Hanus 's avatar Michael Hanus

Merge branch 'version3-integration' into 'master'

Merge version 3 changes

See merge request !1
parents 97273d05 b3e52983
......@@ -25,5 +25,3 @@ sort'post xs ys = length xs == length ys
sort7 = sort (map showInt [7,1,6,3,5,4,2]) -=- map (\d -> "+00"++show d) [1..7]
sortEmpty = toError (sort ([] :: [Int]))
......@@ -4,7 +4,7 @@ import Test.Prop
-- Example: predicate to check for float strings
import Char(isDigit)
import Data.Char (isDigit)
-- Is the argument a non-negative float string (without exponent)?
isNNFloat :: String -> Bool
......@@ -15,4 +15,3 @@ main = map isNNFloat ["3.14","314"]
test1 = isNNFloat "3.14" -=- True
test2 = isNNFloat "314" -=- False
......@@ -5,7 +5,7 @@ import Test.Prop
-- Example: parse World Cup soccer scores (e.g., "_:_", "3:2")
import Char(isDigit)
import Data.Char (isDigit)
parse (team1++" _:_ "++team2) = (team1, team2, Nothing)
parse (team1++[' ',x,':',y,' ']++team2)
......
......@@ -35,4 +35,3 @@ printFl f = ``printf "% 20.4f\n",f''
printEl :: Float -> IO ()
printEl f = do ``printf "%+20.3E",f'' >> putStr " meters\n"
putStrLn "DONE!"
......@@ -39,7 +39,7 @@ testEx3 = (ex3 'a') -=- "This is a char: a"
-- Integer and character formatting:
testIntFixedSignedChar = ``format "%+5d%c",42,c'' -=- " +42%"
where
c = '%'
c = '%'
-- Format a string with a given width and maximal length:
ex4 :: String -> String
......@@ -57,7 +57,7 @@ test_intexp = (ex8 42 2143) -=- "The sum of +00042 and +2143 is +2185.\n"
testFloatFixPrec3 = ``format "%+8.3f",f'' -=- " +3.142"
where
f = 3.14159
-- Format a float with an exponent:
testFloatExp = ``format "% .4E",f'' -=- " 3.1416E+02"
where
......
import Uni
import Database.CDBI.ER
import Database.CDBI.ER
import Database.CDBI.Connection
import Time
import Data.Time
--- Creates the test data for Uni database.
main :: IO ()
main = runJustT $ do
setForeignKeyCheck False
insertEntries student_CDBI_Description studentList
insertEntries student_CDBI_Description studentList
insertEntries lecturer_CDBI_Description lecturerList
insertEntries lecture_CDBI_Description lectureList
insertEntries place_CDBI_Description placeList
insertEntries time_CDBI_Description timeList
insertEntries exam_CDBI_Description examList
insertEntries result_CDBI_Description resultList
insertEntries lecture_CDBI_Description lectureList
insertEntries place_CDBI_Description placeList
insertEntries time_CDBI_Description timeList
insertEntries exam_CDBI_Description examList
insertEntries result_CDBI_Description resultList
insertEntryCombined sseDescription sse1
insertEntries participation_CDBI_Description participList
setForeignKeyCheck True
......@@ -52,7 +52,7 @@ lectureList = [lecture1, lecture2, lecture3]
"This lecture provides an introduction to databases and SQL."
(LecturerID 3)
-- Places
-- Places
placeList :: [Uni.Place]
placeList = [place1, place2]
where
......@@ -76,60 +76,60 @@ examList = [exam1, exam2, exam3, exam4]
exam2 = Exam (ExamID 2) (Just 3.3) (LectureID 1) (TimeID 2) (PlaceID 2)
exam3 = Exam (ExamID 3) (Just 1.7) (LectureID 2) (TimeID 3) (PlaceID 1)
exam4 = Exam (ExamID 4) Nothing (LectureID 3) (TimeID 4) (PlaceID 2)
-- Results
resultList :: [Uni.Result]
resultList =
[result1, result2, result3, result4, result5, result6, result7, result8]
where
result1 = Result (ResultID 1) 1 (Just 5.0) (Just 30) (StudentID 1) (ExamID 1)
result2 = Result (ResultID 2) 2 (Just 3.7) (Just 58) (StudentID 1) (ExamID 2)
result3 = Result (ResultID 3) 1 (Just 1.0) (Just 97) (StudentID 2) (ExamID 1)
result2 = Result (ResultID 2) 2 (Just 3.7) (Just 58) (StudentID 1) (ExamID 2)
result3 = Result (ResultID 3) 1 (Just 1.0) (Just 97) (StudentID 2) (ExamID 1)
result4 = Result (ResultID 4) 1 (Just 1.3) (Just 90) (StudentID 3) (ExamID 1)
result5 = Result (ResultID 5) 1 (Just 1.3) (Just 91) (StudentID 1) (ExamID 3)
result6 = Result (ResultID 6) 1 (Just 5.0) (Just 20) (StudentID 4) (ExamID 1)
result7 = Result (ResultID 7) 2 (Just 5.0) (Just 39) (StudentID 4) (ExamID 2)
result8 = Result (ResultID 8) 1 (Just 5.0) (Just 49) (StudentID 4) (ExamID 3)
cd :: CombinedDescription CreateData.StudentStudentExam
cd = combineDescriptions student_CDBI_Description 0 exam_CDBI_Description 0
(\st ex -> (StudentStudentExam _ st ex))
(\(StudentStudentExam _ st ex) -> (st, ex))
data StudentStudentExam = StudentStudentExam Student Student Exam
sseDescription :: CombinedDescription CreateData.StudentStudentExam
sseDescription =
addDescription student_CDBI_Description 1
sseDescription =
addDescription student_CDBI_Description 1
(\st1 (StudentStudentExam _ st2 ex) -> (StudentStudentExam st1 st2 ex))
(\(StudentStudentExam st _ _) -> st) cd
sse1 :: StudentStudentExam
sse1 :: StudentStudentExam
sse1 =
StudentStudentExam
(Student (StudentID 5) "Mond" "Thorben" 55 "thorben@email.de" (Just 18))
(Student (StudentID 6) "Stern" "Susanne" 77 "susanne@email.de" (Just 18))
(Exam (ExamID 5) (Just 2.2) (LectureID 3) (TimeID 2) (PlaceID 1))
participList::[Participation]
participList::[Participation]
participList = [particip1, particip2, particip3, particip4, particip5,
particip6, particip7, particip8, particip9]
where
particip1 :: Participation
particip1 = Participation (StudentID 1) (LectureID 1)
particip1 = Participation (StudentID 1) (LectureID 1)
particip2 :: Participation
particip2 = Participation (StudentID 2) (LectureID 1)
particip2 = Participation (StudentID 2) (LectureID 1)
particip3 :: Participation
particip3 = Participation (StudentID 1) (LectureID 2)
particip3 = Participation (StudentID 1) (LectureID 2)
particip4 :: Participation
particip4 = Participation (StudentID 3) (LectureID 2)
particip4 = Participation (StudentID 3) (LectureID 2)
particip5 :: Participation
particip5 = Participation (StudentID 4) (LectureID 2)
particip5 = Participation (StudentID 4) (LectureID 2)
particip6 :: Participation
particip6 = Participation (StudentID 1) (LectureID 3)
particip6 = Participation (StudentID 1) (LectureID 3)
particip7:: Participation
particip7 = Participation (StudentID 2) (LectureID 3)
particip7 = Participation (StudentID 2) (LectureID 3)
particip8 :: Participation
particip8 = Participation (StudentID 5) (LectureID 3)
particip8 = Participation (StudentID 5) (LectureID 3)
particip9 :: Participation
particip9 = Participation (StudentID 6) (LectureID 3)
\ No newline at end of file
particip9 = Participation (StudentID 6) (LectureID 3)
......@@ -4,7 +4,7 @@
--- Checking whether the preprocessor detects errors
import Database.CDBI.ER as C
import Time
import Data.Time
import Uni
-- "Scanner" errors
......@@ -15,13 +15,13 @@ testE0 =``sql Select * from Student where Age > 20 & Age < 30;''
-- Parsing errors
--missing semicolon
testE1 :: IO(SQLResult [Student])
testE1 =``sql Select * From Student''
testE1 =``sql Select * From Student''
-- missing table pseudony in Satisfies and missing parenthesis in first condition
testE2 :: IO(SQLResult [(String, String)])
testE2 =``sql Select s.Firstname, s.Email
From Student As s Inner Join Result as r On Satisfies has_a r
Where (r.Attempt = 1 And r.Grade <= 3.0 Or
From Student As s Inner Join Result as r On Satisfies has_a r
Where (r.Attempt = 1 And r.Grade <= 3.0 Or
(r.Attempt = 2 And r.Grade = 1.0);''
-- missing and in between operator
......@@ -47,13 +47,13 @@ testE6 student =``sql Insert Into Student {student};''
-- too much parenthesis surrounding values
testE7 :: IO( SQLResult ())
testE7 =``sql Insert Into Student Values
testE7 =``sql Insert Into Student Values
((10, 2608, "Wulf", "Malte", "mwu@mail.de", 34),
(11, 4736 ,"Krause", "Johanna", "jek@mail.de", 25));''
-- missing into keyword
testE8 :: IO( SQLResult ())
testE8 =``sql Insert Student Values
testE8 =``sql Insert Student Values
(8, 6828, "Julia", "Krone", "julia@mail.de", 26);''
-- using alias in delete query
......@@ -62,7 +62,7 @@ testE81 studName =``sql Delete From Student s Where s.Name = {studName};''
-- missing semicolon
testE82 :: IO( SQLResult ())
testE82 =``sql Insert Into Student Values
testE82 =``sql Insert Into Student Values
(8, 6828, "Julia", "Krone", "julia@mail.de", 26)''
-- SQL/consistency errors
......@@ -80,8 +80,8 @@ testColumns1 = ``sql Select Student.Name, Student.Name from Student, Student;''
-- Point-column has typo and is withour pseudonym and result can not be used in Satisfies
testE9 :: IO( SQLResult [(String, (Maybe Int))])
testE9 = ``sql Select s.Name, r.Points From Student
as s, Result as r Where Point > 45 and Satisfies s has_a result;''
testE9 = ``sql Select s.Name, r.Points From Student
as s, Result as r Where Point > 45 and Satisfies s has_a result;''
-- Alias s defined twice
testE91 :: IO(SQLResult [(String, String)])
......@@ -99,51 +99,51 @@ testE93 = ``sql Select s.Name from Student where exists (Select * from Result as
-- Point has a typo, undefined relation used
testE94 :: IO( SQLResult [(String, (Maybe Int))])
testE94 = ``sql Select s.Name, r.Points From Student
testE94 = ``sql Select s.Name, r.Points From Student
as s, Result as r Where r.Point > 45 and Satisfies s belongs_to r;''
-- alias defined but not used for age
testSE11 :: IO( SQLResult [(String, (Maybe Int))])
testSE11 ``sql Select s.FirstName, s.Age from Student as s Where Age not null;''
testSE11 ``sql Select s.FirstName, s.Age from Student as s Where Age not null;''
-- typo in table name
testE12 :: IO( SQLResult [Student])
testE12 = ``sql Select * From Students;''
testE12 = ``sql Select * From Students;''
-- constraint not allowed
testSE13 :: IO( SQLResult [(String, (Maybe Int))])
testSE13 = ``sql Select s.Firstname, s.Age from Student as s Where s.Age = Null;''
testSE13 = ``sql Select s.Firstname, s.Age from Student as s Where s.Age = Null;''
-- this one at least results in an type error
-- missing values for e-mail which con not be null
testE14 :: IO( SQLResult ())
testE15 = ``sql Insert Into Student Values
(8, 6828, "Julia", "Krone", 26);''
-- missing value for column matnum
testE15 = ``sql Insert Into Student Values
(8, 6828, "Julia", "Krone", 26);''
-- missing value for column matnum
testE15 :: IO( SQLResult ())
testE15 = ``sql Insert Into Student
testE15 = ``sql Insert Into Student
(Key, Name, Firstname, Email, Age)
Values (9,"Susan", "Krone", "susan@mail.de", 17);''
-- non existent column given
testE16 :: IO( SQLResult ())
testE16 = ``sql Insert Into Student
testE16 = ``sql Insert Into Student
(Key, MatNum, Name, Firstname, Career, Age)
Values (9, 2001 ,"Susan", "Krone", "Informatik", 17);''
-- keys are referencing different tables
testE9' :: IO(SQLResult [(Student, Result)])
testE9' =``sql Select Distinct * From Student As s , Result as r
testE9' =``sql Select Distinct * From Student As s , Result as r
Where r.StudentTakingKey = r.Key
Limit 5;''
Limit 5;''
-- type errors
-- keys compared to values
testE10 :: IO(SQLResult [Student])
testE10 = ``sql Select Distinct * From Student As s
testE10 = ``sql Select Distinct * From Student As s
Where Exists
( Select * From Participation As p
( Select * From Participation As p
Where s.Key = p.StudentParticipationKey And p.LectureParticipationKey
In (1,2,3)) Limit 5;''
......@@ -157,41 +157,41 @@ testE17' =``sql Select Name, MatNum From Student Union Select Name From Lecturer
-- Points is of type Int
testE18 :: IO( SQLResult [(String, (Maybe Int))])
testE18 = ``sql Select s.Name, r.Points From Student
as s, Result as r Where r.Points > 45.5 and Satisfies s has_a r;''
testE18 = ``sql Select s.Name, r.Points From Student
as s, Result as r Where r.Points > 45.5 and Satisfies s has_a r;''
-- StudentID compared with column of type Int
testE19 :: IO( SQLResult [String])
testE19 = ``sql Select s.Name From Result As r, Student As s
testE19 = ``sql Select s.Name From Result As r, Student As s
Where s.Key = r.Points Group By s.Name Having r.Grade < 2.0;''
-- Column of type String inside avg function
testE20 :: IO(SQLResult [String])
testE20 = ``sql Select s.Name From Result As r, Student As s
Where s.Key = r.StudentTakingKey And s.Age < 20
testE20 = ``sql Select s.Name From Result As r, Student As s
Where s.Key = r.StudentTakingKey And s.Age < 20
Group By s.Name Having Avg(s.Name) < 0.0;''
-- different types in case branches
testE21 :: IO( SQLResult [(String, String)])
testE21 = ``sql Select s.Name,
Case When s.Age < 20 Then "Young" Else 20 End
Case When s.Age < 20 Then "Young" Else 20 End
From Student as s;''
-- key- and null-value im Case
testE22 :: IO( SQLResult [(String, String)])
testE22 = ``sql Select s.Name,
Case When s.Age < 20 Then s.Key Else Null End
Case When s.Age < 20 Then s.Key Else Null End
From Student as s;''
-- null-value used in case
testE22' :: IO( SQLResult [(String, String)])
testE22' =``sql Select s.Name,
Case When s.Age < 20 Then 19 Else Null End
Case When s.Age < 20 Then 19 Else Null End
From Student as s;''
-- comparison of two embedded expressions
-- comparison of two embedded expressions
testE23 :: Int -> Int -> IO( SQLResult [(String, (Maybe Int))])
testE23 v1 v2 = ``sql Select s.Firstname, s.Age from Student as s Where {v1} < {v2};''
testE23 v1 v2 = ``sql Select s.Firstname, s.Age from Student as s Where {v1} < {v2};''
-- set value to null in update
testE24 :: IO( SQLResult () )
......@@ -207,45 +207,45 @@ testE26 = ``sql Update Student Set Email = 42 Where Not Age < 20;''
-- comparison of int-value to key
testE27 :: IO( SQLResult [String])
testE27 = ``sql Select s.Name From Result As r, Student As s
testE27 = ``sql Select s.Name From Result As r, Student As s
Where s.Key = 1 Group By s.Name Having r.Grade < 2.0;''
-- set int-Column to String value
testE28 :: IO( SQLResult ())
testE28 = ``sql Insert Into Student Values
testE28 = ``sql Insert Into Student Values
(8, "6828", "Julia", "Krone", "julia@mail.de", 26);''
-- null value for not nullable column
testE28' :: IO( SQLResult ())
testE28' = ``sql Insert Into Student Values
testE28' = ``sql Insert Into Student Values
(8, 6828, "Julia", "Krone", Null, 26);''
-- missing value for e-mail
testE28'' :: IO( SQLResult ())
testE28'' = ``sql Insert Into Student (Key, MatNum, Name, Firstname, Email) Values
testE28'' = ``sql Insert Into Student (Key, MatNum, Name, Firstname, Email) Values
(8, 6828, "Julia", "Krone", Null);''
-- two embedded expressions in case
-- two embedded expressions in case
testKeyfail1 :: IO( SQLResult [(StudentID,String)])
testKeyfail1 = ``sql Select s.Name,
Case When s.Age < 20 Then {(StudentID 2)} Else {(StudentID 3)} End
Case When s.Age < 20 Then {(StudentID 2)} Else {(StudentID 3)} End
From Student as s;''
-- key-value and int together
testKeyfail2 :: IO( SQLResult [(StudentID,String)])
testKeyfail2 = ``sql Select s.Name,
Case When s.Age < 20 Then 1 Else s.Key End
Case When s.Age < 20 Then 1 Else s.Key End
From Student as s;''
-- CDBI constraints
-- CDBI constraints
--more than three tables
testE29 :: IO( SQLResult [(Student, UniModel.Result, Exam, Time)])
testE29 =``sql Select * from Student, Result, Exam, Time;''
testE29 =``sql Select * from Student, Result, Exam, Time;''
-- more than five columns
testE30 :: IO( SQLResult [(Int,String,String, String, (Maybe Int), (Maybe Float))])
testE30 =``sql Select s.MatNum, s.Firstname, s.Name, s.Email, r.Points, r.Grade From Student as s, Result as r;''
testE30 =``sql Select s.MatNum, s.Firstname, s.Name, s.Email, r.Points, r.Grade From Student as s, Result as r;''
-- combination of * and set operation
testE31 :: IO( SQLResult [(String, String)]
......@@ -253,45 +253,45 @@ testE31 =``sql Select * from Lecture Union Select * from Lecturer;''
-- group by in exists
testE32 :: IO(SQLResult [Student])
testE32 =``sql Select Distinct * From Student As s
testE32 =``sql Select Distinct * From Student As s
Where Exists
( Select * From Participation As p
( Select * From Participation As p
Where s.Key = p.StudentParticipationKey Group By s.Name )
Limit 5;''
-- order by and limit in exists
-- order by and limit in exists
testE33 :: IO(SQLResult [Student])
testE33 =``sql Select Distinct * From Student As s
testE33 =``sql Select Distinct * From Student As s
Where Exists
( Select * From Participation As p
( Select * From Participation As p
Where s.Key = p.StudentParticipationKey Order By s.Name
Limit 5);''
-- more than one table in exists
-- more than one table in exists
testE34 :: IO(SQLResult [Student])
testE34 =``sql Select Distinct * From Student As s
testE34 =``sql Select Distinct * From Student As s
Where Exists
( Select * From Participation As p, Result as r)
Limit 5;''
-- order by in exists
Limit 5;''
-- order by in exists
testE35 :: IO(SQLResult [Student])
testE35 =``sql Select Distinct * From Student As s
testE35 =``sql Select Distinct * From Student As s
Where Exists
( Select * From Participation As p
( Select * From Participation As p
Where s.Key = p.StudentParticipationKey Order By s.Name )
Limit 5;''
-- limit in exists
testE36 :: IO(SQLResult [Student])
testE36 =``sql Select Distinct * From Student As s
testE36 =``sql Select Distinct * From Student As s
Where Exists
( Select * From Participation As p
( Select * From Participation As p
Where s.Key = p.StudentParticipationKey Limit 5);''
-- set op in exists
testE37 :: IO(SQLResult [Result])
testE37 = ``sql Select Distinct * From Result As r
testE37 = ``sql Select Distinct * From Result As r
Where Exists
( Select s.Name From Student as s
intersect
......@@ -300,8 +300,8 @@ testE37 = ``sql Select Distinct * From Result As r
-- key-value in case expression
testKeyfail :: IO( SQLResult [(StudentID,String)])
testKeyfail = ``sql Select s.Name,
Case When s.Age < 20 Then {(StudentID 2)} Else s.Key End
From Student as s;''
Case When s.Age < 20 Then {(StudentID 2)} Else s.Key End
From Student as s;''
--Tests to demonstrate error management
-- three times used : instead of .
......@@ -334,15 +334,15 @@ testE43 = ``sql Select st.Name from Students as st, Results as r;''
-- type error in case in condition and twice in having
testE44 :: IO(SQLResult [(String, String)])
testE44 = ``sql Select s.Name,
Case When s.Age < 20 Then "Young" Else 20 End
Case When s.Age < 20 Then "Young" Else 20 End
From Student as s Where s.MatNum > 100.0
Group By s.Name Having Avg(s.Name) < 1 ;''
-- too much columns and group by im exists -> da im Translator wird nach erster abgebrochen - okay
testE45 :: IO(SQLResult [Student])
testE45 =``sql Select s.Key, s.MatNum, s.Firstname, s.Name, s.Email, s.Age From Student As s
testE45 =``sql Select s.Key, s.MatNum, s.Firstname, s.Name, s.Email, s.Age From Student As s
Where Exists
( Select * From Participation As p
( Select * From Participation As p
Where s.Key = p.StudentParticipationKey Group By s.Name )
Limit 5;''
......
......@@ -3,14 +3,14 @@
--- test module for integration of SQL
--- using currypp
import Database.CDBI.ER
import Time
import Database.CDBI.ER
import Data.Time
import Uni
-- Selecting key Values
testKey1 :: IO( SQLResult [(StudentID,String)])
testKey1 = ``sql Select s.Key, s.Name from Student as s where s.Key = 1;''
testKey2 :: IO( SQLResult [(StudentID,String)])
testKey2 = ``sql Select s.Key, s.Name from Student as s where s.Key in (1,4,7);''
......@@ -32,16 +32,16 @@ testFK = ``sql Update Result Set StudentTakingKey = 11 Where Key = 9;''
-- Testing case expressions
testCase1 :: IO( SQLResult [(String, String)])
testCase1 = ``sql Select s.Name,
Case When s.Age < 20 Then "Young" Else "Old" End
Case When s.Age < 20 Then "Young" Else "Old" End
From Student as s;''
testCase2 :: IO( SQLResult [(String, String)])
testCase2 = ``sql Select s.Name,
Case When s.Key < 4 Then "First" Else "Second" End
Case When s.Key < 4 Then "First" Else "Second" End
From Student as s;''
-- queries with date-type
--attention - wrong format -> warning
-- queries with date-type
--attention - wrong format -> warning
testDate :: IO(SQLResult ())
testDate = ``sql Insert into Time Values (Null, 24:09:2015:17:25:00);''
......@@ -61,13 +61,13 @@ checkDates = ``sql Select * from Time;''
-- complex having conditions
checkHaving :: IO(SQLResult [(Float, Float)])
checkHaving = ``sql Select Avg(r.Grade), Avg(r.Points)
From Result as r Inner Join Student as s On Satisfies r belongs_to s
checkHaving = ``sql Select Avg(r.Grade), Avg(r.Points)
From Result as r Inner Join Student as s On Satisfies r belongs_to s
Group By s.Name having not Avg(r.Grade) < 3.0 And Avg(r.Points) > 80.0;''
checkHaving1 ::IO(SQLResult [(Float, Float)])
checkHaving1 = ``sql Select Avg(r.Grade), Avg(r.Points)
From Result as r Inner Join Student as s On Satisfies r belongs_to s
checkHaving1 = ``sql Select Avg(r.Grade), Avg(r.Points)
From Result as r Inner Join Student as s On Satisfies r belongs_to s
Group By s.Name having (not (Avg(r.Grade) < 3.0 And Avg(r.Points) > 80.0));''
-- testing warnings for notation difference
......@@ -98,11 +98,11 @@ testAlias3 = ``sql Select Name, Points from Student, Result;''
-- test insert and update with single embedded expressions
testI2 :: Int -> IO (SQLResult ())
testI2 age = ``sql Insert Into Student Values
testI2 age = ``sql Insert Into Student Values
( "Julia", "Kunst", 5959, "juk@mail.de", {age});''
testI3 :: IO (SQLResult ())
testI3 = ``sql Insert into Result (Attempt, StudentTakingKey, ExamResultingKey) Values (1,10,3);''
testU4 :: Int -> IO (SQLResult ())
testU4 x = ``sql Update Student Set Age = {x} Where Age < {x};''
testU4 x = ``sql Update Student Set Age = {x} Where Age < {x};''
......@@ -2,9 +2,9 @@
--- Test module for integration of SQL
import Database.CDBI.Connection
import Database.CDBI.ER
import Time
import Database.CDBI.Connection
import Database.CDBI.ER
import Data.Time
import Uni
import Test.Prop
......@@ -25,9 +25,9 @@ testS1 = queryS1 `returns` Right
,Student (StudentID 6) "Stern" "Susanne" 77 "susanne@email.de" (Just 18)]
testS2 :: IO() -- SQLResult [(Student,Uni_CDBI.Result)])
testS2 = do
testS2 = do
result <- ``sql Select * From Student as s Inner Join Result as r
On Satisfies s has_a r;''
On Satisfies s has_a r;''
printResult result
queryS3 :: IO [String]
......@@ -38,224 +38,224 @@ testS3 :: PropIO
testS3 = queryS3 `returns` ["Muster","Arndt","Ziege","Sonne","Mond","Stern"]
testS4 :: IO() -- SQLResult [String])
testS4 = do
result <- ``sql Select s.Name From Student as s Cross Join Result as r;''
testS4 = do
result <- ``sql Select s.Name From Student as s Cross Join Result as r;''
printResult result
testS5 :: IO() -- SQLResult [(String,String)])
testS5 = do
result <- ``sql Select s.Firstname, s.Name From Student as s;''
testS5 = do
result <- ``sql Select s.Firstname, s.Name From Student as s;''
printResult result
testS6 :: IO() -- SQLResult [(String, (Maybe Int))])
testS6 = do
result <- ``sql Select s.Name, r.Points From Student
as s, Result as r Where r.Points > 45 and Satisfies s has_a r;''
testS6 = do
result <- ``sql Select s.Name, r.Points From Student
as s, Result as r Where r.Points > 45 and Satisfies s has_a r;''
printResult result
testS7 :: IO() -- SQLResult [String])
testS7 = do
testS7 = do
result <- ``sql Select Name From Student Union Select Name From Lecturer;''
printResult result
queryS81 :: IO (SQLResult [(String, String)])