Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 安卓:糖类还是条件_Android_Sugarorm - Fatal编程技术网

Android 安卓:糖类还是条件

Android 安卓:糖类还是条件,android,sugarorm,Android,Sugarorm,我正在使用SugarORM 选择代码: 问题: 以上获得的列表为仅为A类或仅为B类 从官方网站上,它只能为A和B生成和条件,如下所示: record_list = Select.from(Records_records.class).where(Condition.prop("category").eq("A"), Condition.prop("category").eq("B")).orderBy(action).list(); 我怎样才能得到一个列表?一个类别为(a或B)的组合列表,并按

我正在使用SugarORM

选择代码: 问题: 以上获得的列表为仅为A类或仅为B类

从官方网站上,它只能为A和B生成和条件,如下所示:

record_list = Select.from(Records_records.class).where(Condition.prop("category").eq("A"), Condition.prop("category").eq("B")).orderBy(action).list();
我怎样才能得到一个列表?一个类别为(a或B)的组合列表,并按“日期”的顺序排列

谢谢

您可以使用
whereOr()
进行以下操作:

record_list = Select.from(Records_records.class).whereOr(Condition.prop("category").eq("A"), Condition.prop("category").eq("B")).orderBy(action).list();
它是默认值的OR对应项,
where()
使用它

它没有文档记录,但您可以在以下目录中找到:

您可以为此使用
where()

record_list = Select.from(Records_records.class).whereOr(Condition.prop("category").eq("A"), Condition.prop("category").eq("B")).orderBy(action).list();
它是默认值的OR对应项,
where()
使用它

它没有文档记录,但您可以在以下目录中找到:

@Test
public void testWhereOr(){
    Select where = Select.from(TestRecord.class).whereOr(Condition.prop("test").eq("satya"));
    assertEquals("(test = ? )", where.getWhereCond());
    assertEquals(1, where.getArgs().length);
    assertEquals("satya", where.getArgs()[0]);

    where = Select.from(TestRecord.class).whereOr(Condition.prop("test").eq("satya"), Condition.prop("prop").eq(2));
    assertEquals("(test = ?  OR prop = ? )", where.getWhereCond());
    assertEquals(2, where.getArgs().length);
    assertEquals("satya", where.getArgs()[0]);
    assertEquals("2", where.getArgs()[1]);
}