--- a/src/test/scala/SQLTest.scala Thu Dec 10 22:35:15 2009 -0500
+++ b/src/test/scala/SQLTest.scala Fri Dec 11 13:41:19 2009 -0500
@@ -13,7 +13,7 @@
INNER JOIN Employee AS manager ON manager.id=emp.manager
WHERE emp.lastName IS NOT NULL AND manager.lastName IS NOT NULL
"""
- val expected = Select(AttributeList(List(NamedAttribute(FQAttribute(Relation(Name("emp")),Attribute(Name("lastName"))),Attribute(Name("empName"))), NamedAttribute(FQAttribute(Relation(Name("manager")),Attribute(Name("lastName"))),Attribute(Name("managName"))))),TableList(TableAlias(Relation(Name("Employee")),Relation(Name("emp"))),List(Join(TableAlias(Relation(Name("Employee")),Relation(Name("manager"))),Expression(List(PrimaryExpressionEq(FQAttribute(Relation(Name("manager")),Attribute(Name("id"))),RValueAttr(FQAttribute(Relation(Name("emp")),Attribute(Name("manager")))))))))),Some(Expression(List(PrimaryExpressionNotNull(FQAttribute(Relation(Name("emp")),Attribute(Name("lastName")))), PrimaryExpressionNotNull(FQAttribute(Relation(Name("manager")),Attribute(Name("lastName"))))))))
+ val expected = Select(AttributeList(List(NamedAttribute(FQAttribute(Relation(Name("emp")),Attribute(Name("lastName"))),Attribute(Name("empName"))), NamedAttribute(FQAttribute(Relation(Name("manager")),Attribute(Name("lastName"))),Attribute(Name("managName"))))),TableList(TableAlias(Relation(Name("Employee")),Relation(Name("emp"))),List(Join(TableAlias(Relation(Name("Employee")),Relation(Name("manager"))),Some(Expression(List(PrimaryExpressionEq(FQAttribute(Relation(Name("manager")),Attribute(Name("id"))),RValueAttr(FQAttribute(Relation(Name("emp")),Attribute(Name("manager"))))))))))),Some(Expression(List(PrimaryExpressionNotNull(FQAttribute(Relation(Name("emp")),Attribute(Name("lastName")))), PrimaryExpressionNotNull(FQAttribute(Relation(Name("manager")),Attribute(Name("lastName"))))))))
assert(expected === (a.parseAll(a.select, e).get))
}
@@ -37,7 +37,7 @@
AND manager.lastName="Johnson"
WHERE emp.lastName IS NOT NULL
"""
- val expected = Select(AttributeList(List(NamedAttribute(FQAttribute(Relation(Name("emp")),Attribute(Name("lastName"))),Attribute(Name("empName"))))),TableList(TableAlias(Relation(Name("Employee")),Relation(Name("emp"))),List(Join(TableAlias(Relation(Name("Employee")),Relation(Name("manager"))),Expression(List(PrimaryExpressionEq(FQAttribute(Relation(Name("emp")),Attribute(Name("manager"))),RValueAttr(FQAttribute(Relation(Name("manager")),Attribute(Name("id"))))), PrimaryExpressionEq(FQAttribute(Relation(Name("manager")),Attribute(Name("lastName"))),RValueString(Name("Johnson")))))))),Some(Expression(List(PrimaryExpressionNotNull(FQAttribute(Relation(Name("emp")),Attribute(Name("lastName"))))))))
+ val expected = Select(AttributeList(List(NamedAttribute(FQAttribute(Relation(Name("emp")),Attribute(Name("lastName"))),Attribute(Name("empName"))))),TableList(TableAlias(Relation(Name("Employee")),Relation(Name("emp"))),List(Join(TableAlias(Relation(Name("Employee")),Relation(Name("manager"))),Some(Expression(List(PrimaryExpressionEq(FQAttribute(Relation(Name("emp")),Attribute(Name("manager"))),RValueAttr(FQAttribute(Relation(Name("manager")),Attribute(Name("id"))))), PrimaryExpressionEq(FQAttribute(Relation(Name("manager")),Attribute(Name("lastName"))),RValueString(Name("Johnson"))))))))),Some(Expression(List(PrimaryExpressionNotNull(FQAttribute(Relation(Name("emp")),Attribute(Name("lastName"))))))))
assert(expected === (a.parseAll(a.select, e).get))
}
@@ -54,7 +54,7 @@
AND grandManager.birthday < manager.birthday
WHERE emp.lastName IS NOT NULL AND grandManager.lastName IS NOT NULL
"""
- val expected = Select(AttributeList(List(NamedAttribute(FQAttribute(Relation(Name("emp")),Attribute(Name("lastName"))),Attribute(Name("empName"))), NamedAttribute(FQAttribute(Relation(Name("grandManager")),Attribute(Name("lastName"))),Attribute(Name("grandManagName"))))),TableList(TableAlias(Relation(Name("Employee")),Relation(Name("emp"))),List(Join(TableAlias(Relation(Name("Manage")),Relation(Name("lower"))),Expression(List(PrimaryExpressionEq(FQAttribute(Relation(Name("lower")),Attribute(Name("manages"))),RValueAttr(FQAttribute(Relation(Name("emp")),Attribute(Name("id")))))))), Join(TableAlias(Relation(Name("Employee")),Relation(Name("manager"))),Expression(List(PrimaryExpressionEq(FQAttribute(Relation(Name("manager")),Attribute(Name("id"))),RValueAttr(FQAttribute(Relation(Name("lower")),Attribute(Name("manager"))))), PrimaryExpressionLt(FQAttribute(Relation(Name("manager")),Attribute(Name("birthday"))),RValueAttr(FQAttribute(Relation(Name("emp")),Attribute(Name("birthday")))))))), Join(TableAlias(Relation(Name("Manage")),Relation(Name("upper"))),Expression(List(PrimaryExpressionEq(FQAttribute(Relation(Name("upper")),Attribute(Name("manages"))),RValueAttr(FQAttribute(Relation(Name("manager")),Attribute(Name("id")))))))), Join(TableAlias(Relation(Name("Employee")),Relation(Name("grandManager"))),Expression(List(PrimaryExpressionEq(FQAttribute(Relation(Name("grandManager")),Attribute(Name("id"))),RValueAttr(FQAttribute(Relation(Name("upper")),Attribute(Name("manager"))))), PrimaryExpressionLt(FQAttribute(Relation(Name("grandManager")),Attribute(Name("birthday"))),RValueAttr(FQAttribute(Relation(Name("manager")),Attribute(Name("birthday")))))))))),Some(Expression(List(PrimaryExpressionNotNull(FQAttribute(Relation(Name("emp")),Attribute(Name("lastName")))), PrimaryExpressionNotNull(FQAttribute(Relation(Name("grandManager")),Attribute(Name("lastName"))))))))
+ val expected = Select(AttributeList(List(NamedAttribute(FQAttribute(Relation(Name("emp")),Attribute(Name("lastName"))),Attribute(Name("empName"))), NamedAttribute(FQAttribute(Relation(Name("grandManager")),Attribute(Name("lastName"))),Attribute(Name("grandManagName"))))),TableList(TableAlias(Relation(Name("Employee")),Relation(Name("emp"))),List(Join(TableAlias(Relation(Name("Manage")),Relation(Name("lower"))),Some(Expression(List(PrimaryExpressionEq(FQAttribute(Relation(Name("lower")),Attribute(Name("manages"))),RValueAttr(FQAttribute(Relation(Name("emp")),Attribute(Name("id"))))))))), Join(TableAlias(Relation(Name("Employee")),Relation(Name("manager"))),Some(Expression(List(PrimaryExpressionEq(FQAttribute(Relation(Name("manager")),Attribute(Name("id"))),RValueAttr(FQAttribute(Relation(Name("lower")),Attribute(Name("manager"))))), PrimaryExpressionLt(FQAttribute(Relation(Name("manager")),Attribute(Name("birthday"))),RValueAttr(FQAttribute(Relation(Name("emp")),Attribute(Name("birthday"))))))))), Join(TableAlias(Relation(Name("Manage")),Relation(Name("upper"))),Some(Expression(List(PrimaryExpressionEq(FQAttribute(Relation(Name("upper")),Attribute(Name("manages"))),RValueAttr(FQAttribute(Relation(Name("manager")),Attribute(Name("id"))))))))), Join(TableAlias(Relation(Name("Employee")),Relation(Name("grandManager"))),Some(Expression(List(PrimaryExpressionEq(FQAttribute(Relation(Name("grandManager")),Attribute(Name("id"))),RValueAttr(FQAttribute(Relation(Name("upper")),Attribute(Name("manager"))))), PrimaryExpressionLt(FQAttribute(Relation(Name("grandManager")),Attribute(Name("birthday"))),RValueAttr(FQAttribute(Relation(Name("manager")),Attribute(Name("birthday"))))))))))),Some(Expression(List(PrimaryExpressionNotNull(FQAttribute(Relation(Name("emp")),Attribute(Name("lastName")))), PrimaryExpressionNotNull(FQAttribute(Relation(Name("grandManager")),Attribute(Name("lastName"))))))))
assert(expected === (a.parseAll(a.select, e).get))
}