Search code examples
androidandroid-sqliteactiveandroid

ActiveAndroid Update() query


I'm trying to make a bulk update to a column using ActiveAndroid. Here's my code:

new Update(SomeModel.class).set("Enabled = 0").execute();

But I'm getting a StackOverflowError. (Edit: My bad, the error was somewhere else). Does anyone know how to execute an Update() query? It doesn't say anything in ActiveAndroid's wiki.

Edit:

This syntax is correct:

new Update(SomeModel.class)
  .set("Enabled = 0")
  .where("Account = ?", account.getId())
  .execute();

You can skip the where if not needed.


Solution

  • This syntax is correct:

    new Update(SomeModel.class)
      .set("Enabled = 0")
      .where("Account = ?", account.getId())
      .execute();
    

    You can skip the where if not needed.