What Are Differences between Row.REFRESH_UNDO_CHANGES and Row.REFRESH_WITH_DB_FORGET_CHANGES
One of the main differences between the two refresh modes is the following: UNDO undoes changes you've made in this transaction--it backs out changes that may have been posted, but not yet committed. FORGET simpy takes whatever is in the db and refreshes the row with it. Specifically, the two tables below show the differences in the row attr value (value in database and value in cache) between the two modes. Let's say we start with the row attr value of "aaa."
UNDO CASE
Operation Data in Table Data in Cache --------------- ------------- ------------- read into cache aaa aaa setAttr(bbb) aaa bbb postChanges() bbb bbb setAttr(ccc) bbb ccc refresh(UNDO) bbb aaa <=== goes back to orig value "aaa"
FORGET CASE
Operation Data in Table Data in Cache --------------- ------------- ------------- read into cache aaa aaa setAttr(bbb) aaa bbb postChanges() bbb bbb setAttr(ccc) bbb ccc refresh(FORGET) bbb bbb <=== goes back to latest db value "bbb"
UNDO goes back to the value at the beginning of trans. FORGET goes back to whatever is in db table at the time of refresh call.
In terms of implementation, for UNDO, we keep the original (xtn relative) value in the cache row. When you call refresh(UNDO), we push (using setAttr internally) the original values back into the row as if the user called setAttr of these attrs. The row is marked as MODIFIED, so that when you post, the original value ('aaa' in the above example) will go back out to database.
In constrast, after refresh(FORGET), the row will be marked as UNMODIFIED.
9:36:01 AM
|