保存数据:检查值是否已更改?

Lets say your form has a bunch of fields, and usually only 1 or 2 of them are changed and need to be saved. Do you:

  1. Just update the database with all values, regardless if they have changed.
  2. Use form states, and only post back values that have changed.
  3. Check the new value against the old value, externally to the class.
  4. Check the new value against the old value, internally, in the set_property() method.
  5. Then you'd have to keep an array of updated fields to be saved...

I might be wrong, but it seems most examples I've seen just do #1. If you have a large list of 100+ posts in 1 table, you don't want to just loop through and save them all every time you update 1 field...

I'd use #2, keeping track of what has changed since last saved.