联系人操作数据库时我们会经常使用到事务帮我们快速的对多表进行写入更新等操作。下面一行code也是大家经常看到并使用的。
builder.withValueBackReference(StructuredName.RAW_CONTACT_ID, 0);
对于withValueBackReference,ICS源码是这么描述的:
/**
* Add a ContentValues back reference.
* A column value from the back references takes precedence over a value specified in
* {@link #withValues}.
* This can only be used with builders of type insert, update, or assert.
* @return this builder, to allow for chaining.
*/
public Builder withValueBackReference(String key, int previousResult) {
if (mType != TYPE_INSERT && mType != TYPE_UPDATE && mType != TYPE_ASSERT) {
throw new IllegalArgumentException(
"only inserts, updates, and asserts can have value back-references");
}