Data table is usually used in the following three ways:
1. Automatically deliver value.
2. The only name. This is a unique serial number using the algorithm that uses your own definition.
3. GUID (globally unique identifier).
GUID and automatic increment value and unique name
GUID
Generate in the client, determined by the characteristics of the GUID, the value generated by the GUID may have a repetition opportunity almost equal to zero, so that the primary key value is only unique when the table is inserted.
It can be easily handled for distributed data, such as: Branch data, submit to the header - inserting the part of the data directly.
Support offline data processing. The key field value of the data table can be assigned to the local data packet, and the processing method is consistent with the new time.
Automatic deliver value
Generate in the database server side, because the value is processed inside the database system, it guarantees its uniqueness, but because it is generated in the database server, the value must return to the client, the client passes the other operating. For example, a document (primary slave table) is automatically increasing value. When the document is inserted, the key field value of the document is returned, and the document detail (the document is detained by the document ") .
Failure to deal with distributed data, such as: Branch Data Submit to the General Store - The key field value of the data table must be regenerated when submitting data to ensure that the field value is unique.
To support the offline data processing, additional processing needs to be performed, you need to insert a hypothesis unique value when saving the local packet (saved to the local), re-generate the true unique value when submitting offline data back data servers, and re-perform Related processing.
Unique name
Generate or generate on the client side is the algorithm for generating a unique value relative to the automatic delivering value, which is easy to cause errors or other problems. If you generate a unique value in the client, you must also guarantee that the resulting value is unique.
Failure to deal with distributed data, such as branch data, submit (or pre-processed) the key field value of the data table (or pre-processed) to ensure that the field value is unique.
To support the offline data processing, additional processing needs to be performed, you need to insert a hypothesis unique value when saving the local packet (saved to the local), re-generate the true unique value when submitting offline data back data servers, and re-perform Related processing.
Example statement
The following is the difference between the comparison of GUID and automatic delivery value / unique names below
Action GUID Automatic Hand Value / Unique Name Auto Loud Added Singress Lift Key Field Value: Get and Fill in the Current Crestor: No Save Direct Save First Get and Fill in the Key Field Value, then save the return Direct return Back When the key field value is returned to the document value, the file value is added to the document value: directly fill in the document detail key field value: obtain and fill in the associated document header value: No document detail key field value: no saving direct storage acquisition documents Leagon key field values and fill out in the document detail field; then get and fill in the document value of the document;
In integrated, the key field value with GUID as a data sheet is to reduce the operation related to the key field, and is the most direct practical method.