)
),
new ConditionList(
Joiner.AND,
list(
new ListCondition(new FieldValue("b", "partyId"), "IN", GenericTestCaseBase.<Value>list(
new StringValue("1"),
new StringValue("2"),
new StringValue("3"),
new StringValue("4")
)),
new BooleanCondition(new FieldValue("b", "gender"), "=", new StringValue("M"))
)
)
)
),
new BooleanCondition(new FieldValue("b", "firstName"), "LIKE", new StringValue("%foo%")),
null,
list(
new OrderByItem(OrderByItem.Order.DEFAULT, OrderByItem.Nulls.DEFAULT, new FunctionCall("LOWER", GenericTestCaseBase.<Value>list(new FieldValue(null, "lastName")))),
new OrderByItem(OrderByItem.Order.DEFAULT, OrderByItem.Nulls.DEFAULT, new FieldValue(null, "firstName")),
new OrderByItem(OrderByItem.Order.DESCENDING, OrderByItem.Nulls.DEFAULT, new FieldValue(null, "birthDate"))
),
5,
10
);
SQLStatement<?> stmt = stmtIt.next();
assertEquals("firstSelect", select, stmt);
assertEquals("firstSelect:parse", parser(select).SelectStatement(), parser(stmt).SelectStatement());
}
{
SQLInsert insert = new SQLInsert(
new TableName("Party", null),
new InsertValues(
list(
new InsertRow(GenericTestCaseBase.<Value>list(new StringValue("a"), new StringValue("PERSON"), new StringValue("PARTY_DISABLED"))),
new InsertRow(list(new NumberValue<Integer>(Integer.valueOf(5)), new StringValue("PARTY_GROUP"), new ParameterValue("name")))
)
),
list("partyId", "partyTypeId", "statusId")
);
SQLStatement<?> stmt = stmtIt.next();
assertEquals("firstInsert", insert, stmt);
assertEquals("firstInsert:parse", parser(insert).InsertStatement(), parser(stmt).InsertStatement());
}
{
SQLInsert insert = new SQLInsert(
new TableName("Person", null),
new SQLSelect(
false,
null,
GenericTestCaseBase.<String, FieldDef>map(
"partyId", new FieldDef(new FieldValue(null, "partyId"), null),
"firstName", new FieldDef(new MathValue("||", list(new FieldValue(null, "partyId"), new StringValue("-auto"))), "firstName")
),
new Table(new TableName("Party", null), null),
null,
new ListCondition(new FieldValue(null, "partyId"), "IN", GenericTestCaseBase.<Value>list(new StringValue("a"), new StringValue("b"))),
null,
null,
null,
-1,
-1
),
list("partyId", "firstName")
);
SQLStatement<?> stmt = stmtIt.next();
assertEquals("secondInsert", insert, stmt);
assertEquals("secondInsert:parse", parser(insert).InsertStatement(), parser(stmt).InsertStatement());
}
{
SQLUpdate update = new SQLUpdate(
new Table(new TableName("Person", null), null),
list(
new SetField("lastName", new MathValue("||", list(new StringValue("auto-"), new FieldValue(null, "partyId"))))
),
new ListCondition(new FieldValue(null, "partyId"), "IN", GenericTestCaseBase.<Value>list(new StringValue("a"), new StringValue("b")))
);
SQLStatement<?> stmt = stmtIt.next();
assertEquals("firstUpdate", update, stmt);
assertEquals("firstUpdate:parse", parser(update).UpdateStatement(), parser(stmt).UpdateStatement());
}
{
SQLUpdate update = new SQLUpdate(
new Table(new TableName("Person", null), null),
list(
new SetField("lastName", new MathValue("||", list(new StringValue("auto-"), new FieldValue(null, "partyId")))),
new SetField("height", new NumberValue<Integer>(Integer.valueOf(5))),
new SetField("width", new NumberValue<Integer>(Integer.valueOf(7)))
),
new ListCondition(new FieldValue(null, "partyId"), "IN", GenericTestCaseBase.<Value>list(new StringValue("a"), new StringValue("b")))
);
SQLStatement<?> stmt = stmtIt.next();
assertEquals("secondUpdate", update, stmt);
assertEquals("secondUpdate:parse", parser(update).UpdateStatement(), parser(stmt).UpdateStatement());
}
{
SQLUpdate update = new SQLUpdate(
new Table(new TableName("Person", null), null),
list(
new SetField("lastName", new MathValue("||", list(new StringValue("auto-"), new FieldValue(null, "partyId")))),
new SetField("height", new NumberValue<Integer>(Integer.valueOf(6))),
new SetField("width", new NumberValue<Integer>(Integer.valueOf(5))),
new SetField("nickname", new StringValue("a"))
),
new ListCondition(new FieldValue(null, "partyId"), "IN", GenericTestCaseBase.<Value>list(new StringValue("a"), new StringValue("b")))
);
SQLStatement<?> stmt = stmtIt.next();
assertEquals("thirdUpdate", update, stmt);
assertEquals("thirdUpdate:parse", parser(update).UpdateStatement(), parser(stmt).UpdateStatement());
}
{
SQLDelete delete = new SQLDelete(
new Table(new TableName("Person", null), null),
new ListCondition(new FieldValue(null, "partyId"), "IN", GenericTestCaseBase.<Value>list(new StringValue("a"), new StringValue("b")))
);
SQLStatement<?> stmt = stmtIt.next();
assertEquals("firstDelete", delete, stmt);
assertEquals("firstDelete:parse", parser(delete).DeleteStatement(), parser(stmt).DeleteStatement());
}
{
SQLDelete delete = new SQLDelete(
new Table(new TableName("Party", null), null),
new ListCondition(new FieldValue(null, "partyId"), "IN", GenericTestCaseBase.<Value>list(new StringValue("a"), new StringValue("b")))
);
SQLStatement<?> stmt = stmtIt.next();
assertEquals("secondDelete", delete, stmt);
assertEquals("secondDelete:parse", parser(delete).DeleteStatement(), parser(stmt).DeleteStatement());
}