Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to set a file as Exclusive
Message
 
À
30/05/2003 09:26:01
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00794408
Message ID:
00794915
Vues:
16
Hi Cetin.
Thaks for the code.. food for thought.

Regards,

Gerard


>Gerard,
>Didn't understand the need but doesn't matter :)
>"If nobody else has the file open"
>You could do in this case :)
>
>
>function ZapIt
>lparameters tcTableFullpath
>local llInUse, lnInUse, lcAlias, ix
>local array arrInUse[1], arrUsedIn[1]
>lnInUse = aused(arrInUse)
>for ix=1 to lnInUSe
>    if dbf(arrInUse[ix,1]) == upper(tcTableFullpath)
>       use in (arrInUse[ix,1])
>       dimension arrUsedIn[iif(type('arrUsedIn[1]')='N',1,0)+;
>          alen(arrUsedIn)]
>          arrUsedIn[alen(arrUsedIn)] = ix
>       llInUse = .t.
>    endif
>endfor
>select 0
>if fopen(tcTableFullpath,12) && Nobody else is using - including private datasessions
>   fclose(tcTableFullpath)
>   use (tcTableFullpath) exclusive
>   zap
>   use
>   if llInUse
>   for ix=1 to alen(arrUsedIn)
>      use (tcTableFullpath) in 0 alias (arrInUse[arrUsedIn[ix],1])
>   endfor
>   endif
>endif
>
>PS: Untested, not exclusively checking errors, not checking other datasessions, not checking and restorin order etc
>Cetin
>
>>Hi Cetin.
>>Yes. this is the reason why it should be exclusive.
>>So what I want to do is:
>>
>>
>>Sele MyFile
>>If nobody else has the file open
>> Open it exclusive
>> Zap it
>>Endif
>>Open it shared again
>>
>>This has come about because of the following:
>>
>>A file that a match was being done on has say 700,000 records
>>If a particular condition arises, a complete rematch needs to be done.
>>Up to now , I used a delete all, and re-did the match... it was going to take 2 weeks (yes 14 days we reckoned) non stop processing.
>>
>>I zapped the file and it took 20 mins !!!
>>
>>
>>regards,
>>
>>Gerard
>>
>>
>>
>>
>>>>Hi.
>>>>I have all my Tables set up in DE, and Set Exclu is off.
>>>>However, there is one case where I need to be able to temporarily open the table exclusively, because I want to Zap the file.
>>>>
>>>>If I set exclu on, it does not work for tables already opened.
>>>>How do I do this for a table that is already opened, Zap the file, and then go back to using it non exclusively.
>>>>
>>>>regards,
>>>>
>>>>Gerard
>>>
>>>Gerard,
>>>Impossible. Assuming it was possible for a moment why would you ever want to do that. Think I'm user xx on station yy and have that table open, you zap and suddenly out of the blue the table I'm working on has no records !
>>>Cetin
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform