AttributeTest

An AttributeTest defines a filter condition using an MBO attribute, and supports multiple conditions. The IN, NOT_IN, EXISTS, and NOT_EXISTS conditions have been added.

For example, this code is equivalent to SELECT * from A where id in [1,2,3]:
ts2 = new AttributeTest();
ts2.Attribute = "c.id";
Query query = new Query();
ts2.TestValue = query;

ts3= new AttributeTest();
ts3.Attribute = "c.id";
Sybase.Collections.ObjectList v = new Sybase.Collections.ObjectList();
v.Add("1");
v.Add("2");
v.Add("3");
ts2.Value = v;
ts2.SetOperator(AttributeTest.IN);
When using EXISTS and NOT_EXISTS, the attribute name is not required in the AttributeTest. The query can reference an attribute value via its alias in the outer scope. This following code is equivalent to SELECT * from A a where exist (select * from B b where b.id = a.id):
Query query2 = new Query();
query2.Select("a.id");
query2.From("AllType", "a");
AttributeTest  test2 = new AttributeTest();
Query existQuery = new Query();
existQuery.Select("b.id");
existQuery.From("AllType", "b");
Column cl = new Column();
cl.Alias = "a";
cl.Attribute = "id";
test11 = new AttributeTest();
test11.Attribute = "b.id";
test11.Value = cl;
test11.SetOperator(AttributeTest.EQUAL);
existQuery.Where(test11);
test2.Value = existQuery;
test2.SetOperator(AttributeTest.EXISTS);
query2.Where(test2);
qs = SampleAppDB.ExecuteQuery(query2);