Ton*_*yGW 5 sqlite orm android crud
我是Android上使用SQLite和Sugar ORM进行应用程序开发的新手,并尝试阅读Sugar ORM文档,但没有找到任何有关如何在SQLite中更新已保存对象的内容.我可以在更改其属性后保存对象吗?就像是:
Customer myCustomer = (Customer.find(Customer.class, "id = ?", id)).get(0);
myCustomer.setName("new name");
myCustomer.setAddress("new Address");
myCustomer.save(); // is this okay for updating the object?
Run Code Online (Sandbox Code Playgroud)
save()方法不会创建另一个新对象,同时保持旧条目不变,对吗?
您的代码应该没有问题地更新行.
Book book = Book.findById(Book.class, 1);
book.title = "updated title here"; // modify the values
book.edition = "3rd edition";
book.save(); // updates the previous entry with new values.
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
7296 次 |
最近记录: |