Home > Back-end >  What scenarios used part of the field update?
What scenarios used part of the field update?

Time:10-08

Mybatis recently in learning, to understand the update can be part of the field through the if labels, such as,
If a property is null, from won't go to update this field,

So the question comes, in reality this scene?

The QQ information, for example, to edit, system will automatically fill in all the information listed in the input box,
Users don't want to change the place will remain motionless, just to change you want to save the item information.
When click save changes, the server directly test whether mandatory fill in, and then a whole field update to go, isn't it?

Why to determine whether certain attributes to fill in, and then "part of the field update"?
Is it, if say, there is a so-and-so mall, commodity information in the edit interface, will not help the user to fill in the information list?

Expression may not too clear, but really tried my best...

Thanks for the answer!!

CodePudding user response:

This is the scope of database operations as small as possible
Due to some storage factors (such as the index, etc.), for the renewal of the field to bring certain load database: you make a record of the update all the fields a put only part of the field and update of the price is not the same drops
In addition to the data communication between the server load, if the field a lot or to update the record of a lot of words, the effect is obvious

CodePudding user response:

As little as possible database operation, there is a single field modification, if the decrease in the number of inventory, only to change the quantity is ok, don't will again name, number of what,

CodePudding user response:

First said the if you judge the null, he in fact is not necessarily to achieve partial updates, his purpose may not be a null value written to the database, and the demand is usually used for strong update or not updated, and part of the update, as long as it's not directly update the full table or more than 15 fields, the so-called full update and part of the field updates to reduce the pressure of the database, the effect of the micro, just because of special cases, need to deal with these fields alone, the real case of, for example, bank transfer, you can only operate the transfer amount and you want to transferred to who, last update is your amount and operation time and operation record
  • Related