Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Visual FoxPro fails on 11/18/1998
Message
 
À
18/11/1998 11:00:17
Richard Danley
Tri-B Computer Systems
Hilliard, Ohio, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00158805
Message ID:
00158907
Vues:
17
>This morning (11/18/1998) I came to work to discover that our main VFP 5.0 application was not working in any of our offices.
>
>The problem resulted from the fact that we're using SUBSTR(SYS(2015), 3, 10) to create unique names for cursors and temporary tables (Note that this is as reccommended in the VFP documentation under the SYS(3)-Legal File Name topic).
>
>On 11/18/1998, the expressesion generates a string beginning with zero. This seems to be the cause of the problem. The solution was simply to preface the expression with a letter (ex: 'T'+SUBSTR(SYS(2015)).
>
>If anyone else has experienced the problem today, give this a try!

Richard --

FWIW, you can use SECONDS() instead of SYS(2015) to create unique file names:

LOCAL m.lcFileName, m.lcTempDBF, m.lcTempCDX
m.lcFileName = 'XX' + STR(100000 + SECONDS(), 6)
m.lcTempDBF = m.lcFileName + '.DBF'
m.lcTempCDX = m.lcFileName + '.CDX'

<--- Add your code to create the temporary table and index. Then, when you are finished, do this to clean up:

USE IN (m.lcTempDBF)
DELETE FILE m.lcTempDBF
DELETE FILE m.lcTempCDX

I have used this approach in quite a few network apps (many concurrent users) with no problems at all. If you have a concern about two users running this code at exactly the same instant (theoretically getting the same value for SECONDS()), then you could substitute 'XX' with something like the user's login code or workstation ID in order to guarantee uniqueness.

Bill
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform