1

我实现了上面的代码,这是来自 DBFlow 教程的代码

Update<Ant> update = new Update().table(Ant.class).set(Condition.column(Ant$Table.TYPE).eq("other"))
  .where(Condition.column(Ant$Table.TYPE).is("worker"))
  .and(Condition.column(Ant$Table.ISMALE).is(true));
update.queryClose();

Update()得到queryClose()红色。

事实上,在 DBFlow 的 Update 类中甚至没有出现我刚刚粘贴的代码中显示的方法 table()。

有人知道如何实现更新语句吗?谢谢

4

3 回答 3

1

我遇到了同样的问题Update()and queryClose(),我通过使用这样的对象更新数据库来解决它

mObject.setType("other");
mObject.update();

于 2015-05-12T07:55:47.910 回答
0

您拥有的查询将返回一个Where对象。然后你的Where对象将有.queryClose()方法。

Where update = new Update().table(Ant.class).set(Condition.column(Ant$Table.TYPE).eq("other"))
  .where(Condition.column(Ant$Table.TYPE).is("worker"))
  .and(Condition.column(Ant$Table.ISMALE).is(true));
update.queryClose();
于 2015-06-22T21:23:34.063 回答
0

您需要将 Java 版本从 1.6 升级到 1.7。

如果 Android Studio -> 在应用程序文件夹中打开您的 gradle.build 并修复它们

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

文档仍然很旧,然后使用它:

Where update = new Update<>(Ant.class).set(Condition.column(Ant$Table.TYPE).eq("other"))
  .where(Condition.column(Ant$Table.TYPE).is("worker"))
  .and(Condition.column(Ant$Table.ISMALE).is(true));
update.queryClose();
于 2015-10-06T08:07:05.520 回答