Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Shorter than sys(2015)
Message
From
05/02/2015 08:11:15
Lutz Scheffler (Online)
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Web
Miscellaneous
Thread ID:
01614860
Message ID:
01614911
Views:
55
>>SYS(2015) is not very good uniqe (for example for temp files on a multiuser scenario its not fast enough, I had crashes for non unique filles)
>>
>>This is by the way it is created.
>>
>>Lutz
>
>Are you sure you are not confused with sys(3)? I never had a problem with uniqueness of sys(2015), I just did a crude test creating a million records in a cursor, it took 0.786 seconds (1272 records every millisecond) and got zero collision.
>
>
>CREATE CURSOR c_test (PK I AUTOINC, VALUE C(10))
>
>lnStart			= SECONDS()
>FOR i = 1 TO 1000000
>	INSERT INTO c_test (value) VALUES (SYS(2015))
>NEXT i
>
>? SECONDS() - lnStart
>
>SELECT value, COUNT(*) cnt GROUP BY 1 ORDER BY 2 DESC FROM c_test HAVING cnt > 1
>
Hi Hugo,

No. SYS(2015). I even have a central handler to create unique file name on a predefined folder. (so it was a cheap change)
It dependes on the storage location and the number of users. No problems for a decade, but now too many users will make it happen sometimes in a month.

I remember it very well. Two threads created the same file with different input. No problem with write / read access. But terrible effects when the wrong process read the data stored in the file .... Sporadic, never on the dev sys, never on testing. No hint, no nothing.

Then your example might be to slow because INSERT INTO needs time. But this depends slightly on your machine. (I have no machine in this range, or no idea what would be he fastest way to create this)

from VFP help
snip
Calling SYS(2015) more than once during the same millisecond interval returns a unique character string
/snip

Possibly you run your example, let's say for some hours (it should not exeed 2GB ot he numbers of rows allowed), on several threads on several comps and check how many collisions you have created. No need for the autoinc field.
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Reply
Map
View

Click here to load this message in the networking platform