dbTalk Databases Forums  

Sys(3)

comp.databases.xbase.fox comp.databases.xbase.fox


Discuss Sys(3) in the comp.databases.xbase.fox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
ShahJagat
 
Posts: n/a

Default Sys(3) - 10-19-2003 , 01:35 PM






I wanted to know how sys(3) works.

Does it generate a different value everytime? Is it possible two concurrent
users on same network can come up with same values with sys(3).

I wanted to use the sys(3) to generate unique ID's. Any chance it can reproduce
the SAME value that it generated some months or years ago?

Thanks in advance...

Reply With Quote
  #2  
Old   
Eric den Doop
 
Posts: n/a

Default Re: Sys(3) - 10-19-2003 , 03:01 PM






Hello, ShahJagat!
You wrote on 19 Oct 2003 18:35:28 GMT:

S> Does it generate a different value everytime? Is it possible two
S> concurrent users on same network can come up with same values with
S> sys(3).
S> I wanted to use the sys(3) to generate unique ID's. Any chance it can
S> reproduce the SAME value that it generated some months or years ago?

Did you take a look at the Remarks-section in VFP help on SYS(3)?
<vfp_help>
SYS(3) may return a non-unique name when issued successively on a fast
computer. Use SUBSTR(SYS(2015), 3) to create unique, legal eight character
file name.
</vfp_help>

So, no it is not unique. You are better off using a normal primary key
generator/stored procedure like the one that is in the Tastrade sample
database. This one's called NewID(). Or, if you're using VFP8, try the new
AutoInc field type.

Take a look at these articles for info on primary key generators:
http://www.craigberntson.com/Articles/kb006.htm
http://www.foxite.com/articles/013.htm
http://www.foxite.com/articles/033.htm
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8



Reply With Quote
  #3  
Old   
Jan Bucek
 
Posts: n/a

Default Re: Sys(3) - 10-20-2003 , 04:57 AM



shahjagat (AT) aol (DOT) com (ShahJagat) wrote in message news:<20031019143528.09953.00000512 (AT) mb-m24 (DOT) aol.com>...
Quote:
I wanted to know how sys(3) works.

Does it generate a different value everytime?
Yes, the problem with no-unique value from sys3 has arised still in
FPD 2/2.5,6 on fast computers. I have used my own SYS3:
---
FUNCTION mySys3() && syntax is VFPx!!!!
private all like x*
xcSys3=SYS(3)
DO WHILE xcSys3==SYS(3)
doevents
ENDDO
RETURN xcSys3
---
Quote:
Is it possible two concurrent
users on same network can come up with same values with sys(3).
I guess it is possible. You have to use another logic to gain an
unique value for more users (net workstations).

Quote:
I wanted to use the sys(3) to generate unique ID's. Any chance it can reproduce
the SAME value that it generated some months or years ago?

Thanks in advance...

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.