@@ -21,11 +21,10 @@ main = do
21 Left err -> putStrLn (show err)
21 Left err -> putStrLn (show err)
22 Right sessionId -> do
22 Right sessionId -> do
23 --4. define a new relation variable with a DatabaseContext expression
23 --4. define a new relation variable with a DatabaseContext expression
24− let attrExprs = [AttributeAndTypeNameExpr "name" (PrimitiveTypeConstructor "Text" textAtomType),
24+ let attrList = [Attribute "name" textAtomType,
25− AttributeAndTypeNameExpr "age" (PrimitiveTypeConstructor "Int" intAtomType)]
25+ Attribute "age" intAtomType]
26− attrs = attributesFromList [Attribute "name" textAtomType,
26+ attrs = attributesFromList attrList
27− Attribute "age" intAtomType]
28− mErr1 <- executeDatabaseContextExpr sessionId conn (Define "person" attrExprs)
27+ mErr1 <- executeDatabaseContextExpr sessionId conn (Define "person" (map NakedAttributeExpr attrList))
29 putStrLn (show mErr1)
28 putStrLn (show mErr1)
30 --5. add a tuple to the relation referenced by the relation variable
29 --5. add a tuple to the relation referenced by the relation variable
31 let (Right tupSet) = mkTupleSetFromList attrs [[textAtom "Bob", intAtom 45]]
30 let (Right tupSet) = mkTupleSetFromList attrs [[textAtom "Bob", intAtom 45]]