Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Force dbf to close for index/reindex with Win32API??
Message
De
11/01/2005 10:19:43
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
11/01/2005 00:32:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows '98
Network:
Windows NT
Database:
Visual FoxPro
Divers
Thread ID:
00975938
Message ID:
00976034
Vues:
17
As Víctor says, it is potentially dangerous to force a file close.

What I did was with pure VFP code: if a file with a special name exists (I used "maintenance.tmp"), this is a sign that the application should be shut down, for maintenance.

(1) A Timer in the application checked every two minutes whether this file exists. If it exists, it will invoke goProgram.OnQuit() (this is the appropriate method in the Visual Extend framework). In theory, this solution is not perfect. If there are pending changes, the application will not quit immediately; the user will see the dialog for saving pending changes, instead. However, this didn't cause me trouble in practice.

(2) On application startup, the application also check for this file. If it exists, the user will get an error message, and the application will quit immediately.

Finally, I tried to do database maintenance, as much as possible, at midnight. But for some emergency repairs (like reindexing when there was an index corruption), I had to institute the procedure outlined above.

>Hi,
>
>In order to index/reindex a dbf file, we must open that
>dbf file exclusively.
>
>However, in some case, the file to index/reindex is open by
>other, therefore, is any Win32API to force the other party
>to close the file that we want to index/reindex so that
>we can proceed to index/reindex that file.
>
>Any example is appreciated. Thank you
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform