Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
I don't know what the Hacker's Guide says on this subject, but the PACK command does something similar to your code. Ie: It copies the non-deleted records to a temp file, it deletes the original file and renames the temp to the original file name.
IMHO, the only critical moment is when the old file is deleted and the temp one renamed, which both are very short.
In your code, if anything goes wrong while the APPEND is processed, the table is damaged anyway. And this APPEND may take a long time, so, more chances to go wrong.
Vlad
>Hi Vlad,
>Not for you :) If he's doing "pack" for first time I just don't want to be responsible of "gone with the wind" records. Even a power failure occurs in between there wouldn't be loss.
>OTOH as Hacker's Guide suggest I never think to arm end-users with a direct pack command.
>Cetin
>
>>Why is this better?
>>
>>Vlad
>>
>>>If you're doing this first time then I advise you to use another way :
>>>select * from myTable where !deleted() into table myClean
>>>
>>>Then if you're satisfied with myClean.dbf contents :
>>>
>>>use myTable exclusive
>>>zap
>>>append from myClean
>>>
>>>Cetin
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement