An AttributeTest defines a filter condition using an MBO attribute, and supports multiple conditions.
SELECT * from A where id in [1,2,3]
Query query = new Query(); AttributeTest test = new AttributeTest(); test.setAttribute("id"); com.sybase.collections.ObjectList v = new com.sybase.collections.ObjectList(); v.add("1"); v.add("2"); v.add("3"); test.setValue(v); test.setOperator(AttributeTest.IN); query.where(test);
SELECT a.id from AllType a where exists (select b.id from AllType b where b.id = a.id)
Query query = new Query(); query.select("a.id"); query.from("AllType", "a"); AttributeTest test = new AttributeTest(); Query existQuery = new Query(); existQuery.select("b.id"); existQuery.from("AllType", "b"); Column cl = new Column(); cl.setAlias("a"); cl.setAttribute("id"); AttributeTest test1 = new AttributeTest(); test1.setAttribute ("b.id"); test1.setValue(cl); test1.setOperator(AttributeTest.EQUAL); existQuery.where(test1); test.setValue(existQuery); test.setOperator(AttributeTest.EXISTS); query.where(test); QueryResultSet qs = SMP101DB.executeQuery(query);