Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to change the read-only setup of a file by code ?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00423846
Message ID:
00424005
Vues:
16
>I want to protect my database against corruption.
>Someone in the thread told me to put the database container in read-only. Is it something that we can do by code (on-off) or do we have to do it from windows absolutely ? I ask it because sometimes, I send a patch by email that is changing the database, so at this time, I need to be able to write it.
>
>Thanks
>Eric

Using file attributes will not necessarily prevent corruption. The only 100% fix for corruption is a regular backup. In fact, a read-only attribute on the DBC can corrupt your DBC.

create database dummy
create table table1 (keyid I, descript C(30))
alter table table1 add primary key keyid tag keyid
close all

&& make the DBC read-only

open database dummy
alter table table1 drop primary key
&& database is now corrupted and you can no longer open table1

Any creation or deleting of indexes will corrupt a DBC that is read-only.
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform