Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fixing memo corruption
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01116074
Message ID:
01116457
Vues:
17
Sergey,

First, thank you for reviewing my code and your suggestion. I was wondering, do you suggest to change the code because your version has fewer lines or there is a technical reason for it? I mean, do you believe that you code will detect memo corruption better?

>I would rather do this way
>SCAN
>	nCount = nCount + 1
>	nRecno  = RECNO("ORIG_FILE")
>
>	TRY
>		SCATTER NAME oRec MEMO
>		INSERT INTO TEMP_COPY FROM oRec
>	CATCH TO oExp WHERE oExp.ErrorNo = 41
>		lCorruptionFound = .T.
>	ENDTRY
>ENDSCAN
>
>
>>I am looking for suggestions or comments regarding my approach to cleaning up a table(s) from a certain memo corruption.
>>
>>This particular corruption manifests itself in the error 41 "Memo file c:\datafolder\mytable.FPT is missing or is invalid"
>>
>>I create a little program that copies all records from the "problem" table to a free table (of the same structure), using Try/Catch to "rid" of bad records.
>>
>>Here is my code:
>>
>>
>>*-- ORIG_FILE is the "problem" table
>>*-- TEMP_COPY is the file to which records are being copied.
>>SELECT ORIG_FILE
>>nCount = 0
>>SCAN
>>   nCount = nCount + 1
>>   nRecno  = RECNO("ORIG_FILE")
>>
>>   APPEND BLANK IN TEMP_COPY
>>   FOR i = 1 TO FCOUNT()
>>       cFld = FIELD(i)
>>       try
>>        replace (cFld) WITH EVAL("ORIG_FILE." + FIELD(i)) in TEMP_COPY
>>       CATCH
>>	lCorruptionFound = .T.
>>       FINALLY
>>         *-- I can't figure out what to do in Finally, so far.
>>       ENDTRY
>>   NEXT
>>ENDSCAN
>>
>>
>>So far this routine when applied to one "bad" table seemed to have fixed the problem.
>>
>>But I was wondering if anybody sees flaws or shortcomings of the above method.
>>
>>Thank you in advance for any input.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform