Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Multi location Database Application
Message
 
 
À
02/10/2001 23:55:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00471633
Message ID:
00563575
Vues:
21
>Hi,
> Thank you reply.
>I am writing module for data replication. I am using the simplest method to get the changed record, that is, compare the current working tables' records with my backup tables' record. Each of the records of working table will be SCAN, and SEEK the same table from my backup. After that, all the changed records will be INSERTED to forwardtable.
> After that, the forwardtables will be copied to main server (in specific directory). My udaterec() method will SCAN through all changed records and update my main database.
>
>
>SELECT forwardtable
>SCAN
>   SELECT mymaintable
>   <b>locate for KeyID =  EVAL(cprikey) and !deleted()</b>
>   IF FOUND()
>       ***UPDATE to maintable
>   ELSE
>       ***INSERT INTO maintable
>   ENDIF
>ENDSCAN
>
>
>I have problem that, SEEK always locate to the 1st matched of records. It is because there are two duplicated record in the table. One of them is deleted and the other is not.
>How could I SEEK to the correct record in this situation? BTW, some of the tables don't have primary key (I knwo it is bad design). I decided to define primary for each tables. However, I still got a problem of deleted record. Since we are using DELETE and INSERT while updating record, the primary key may need to have filter - NOT DELETED(). If so, the deleted records will not appear once I SET ORDER TO myprimary for SEEK. I need to detect the deleted status to delete/recall that records from main database.
>
>Any ideas?
>
>Thank you

You can use LOCATE instead of SEEK in this situation. See change in bold.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform