Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update Confilict Management
Message
De
18/08/2000 10:51:19
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00406644
Message ID:
00406652
Vues:
19
>Is there a way to manage tableupdate conflicts on buffered tables at the field level. If the record (could be several records) have been changed I need to check to see if the data in each field has changed. I think I can do this with curval and oldval. I found some good info on this in the help file.
>
>The problem is I think I need to update the data in the fields that have changed and not over write the entire record. My updates usually involve several tables with relations, etc...
>
>Is there some good info on this subject around other than the vfp help file?
>
>Thomas Martin

2 ways:
1)
Use GETFLDSTATE(-1) to determine the fields that have changed. Keep in mind the first digit in the list returned by GETFLDSTATE(-1) refers to the deleted flag. e.g.
GETFLDSTATE(-1) returns "111211"
Leftmost character is for deleted flag, 1 means "existing record, not changed", 2 means "existing record, changed" - so the 3rd field has been changed.
If there were no 2's, then the record was not changed.
OLDVAL() and CURVAL() can then be used to determine if the field was truly changed, since REPLACE field1 WITH field1 still results in a changed value in GETFLDSTATE()

2)
Use local views instead of the table itself. There is a view setting, DBGETPROP("viewname", "View", "WhereType"), that tells the view which fields to check when performing updates. 3 = key and modified fields - i.e., "where keyfield = keyvalue and modified_field1=...." This setting will only get an update conflict if one of the modified fields had been changed since the buffer was created.
Insanity: Doing the same thing over and over and expecting different results.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform