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. This information supersedes the existing information in the Developer Guide for Windows and Windows Mobile.
SELECT a.id from AllType a where a.id in (1,2,3)
Sybase.Persistence.Query query = new Sybase.Persistence.Query(); query.Select("a.id"); query.From("AllType", "a"); Sybase.Persistence.AttributeTest ts2 = new Sybase.Persistence.AttributeTest(); ts2.Attribute = "a.id"; Sybase.Collections.ObjectList v = new Sybase.Collections.ObjectList(); v.Add(1); v.Add(2); v.Add(3); ts2.Value = v; ts2.SetOperator(Sybase.Persistence.AttributeTest.IN); query.Where(ts2); Sybase.Persistence.QueryResultSet qs = DsTestDB.ExecuteQuery(query);
SELECT a.id from AllType a where exists (select b.id from AllType b where b.id = a.id)
Sybase.Persistence.Query query = new Sybase.Persistence.Query(); query.Select("a.id"); query.From("AllType", "a"); Sybase.Persistence.AttributeTest test = new Sybase.Persistence.AttributeTest(); Sybase.Persistence.Query existQuery = new Sybase.Persistence.Query(); existQuery.Select("b.id"); existQuery.From("AllType", "b"); Sybase.Persistence.Column cl = new Sybase.Persistence.Column(); cl.Alias = "a"; cl.Attribute = "id"; Sybase.Persistence.AttributeTest test1 = new Sybase.Persistence.AttributeTest(); test1.Attribute = "b.id"; test1.Value = cl; test1.SetOperator(Sybase.Persistence.AttributeTest.EQUAL); existQuery.Where(test1); test.Value = existQuery; test.SetOperator(Sybase.Persistence.AttributeTest.EXISTS); query.Where(test); Sybase.Persistence.QueryResultSet qs = DsTestDB.ExecuteQuery(query);