Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Uniqueness of SYS(2015)
Message
De
24/06/2007 20:04:46
 
 
À
24/06/2007 17:25:42
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01235219
Message ID:
01235269
Vues:
16
>>Hi Everybody,
>>
>>To generate a unique record id value, in lieu of using either:
>>
>>1. the AUTOINC field type
>>2. using a table that houses a LastNumber field and have a GetLastNumber() function to lock and return value.
>>
>>Will using SYS(2015) do the job? I mean, is its uniqueness 'guaranteed' if its being invoked by 100 or more workstations simultaneously?
>>
>>Thanks
>>Dennis
>
>Its uniqueness would even break with 2 workstations. Use a GUID.
>Cetin

True, since SYS(2015) is derived from the workstation clock, and workstations on networks are never completely synchronized. It is a pretty sure-fire unique value on one single system, though -- running SYS(2015) in a tight loop on my 3.4 Pentium with 2GB memory did not produce any duplicates during 1000 iterations, though. But a GUID would give you a truly unique ID, every time.

The LastPKID() -strategy has a few important benefits, however: While it is a bit more (setup) work than simply getting a GUI, with this approach you can create integer keys, which take a whole lot less space than GUI and are a whole lot faster to search (in a huge data table).

I don't personally completely trust the autoincrement -field property in VFP -- it has problems specifically if you use views or stored procedures. Also, since the current autoinc value is stored in the table header, it is at risk during crashes.

---

By the wey, Cetin, how do you like Ideablade Devforce now that you've been using it for a while? I've been looking at it seriously lately (although I use Strataframe for a lot of my .NET work), mainly because of the Business Object Server (BOS) component, which will play very nicely with Microsoft's new Silverlight environment. As I understand it, Silverlight uses web services to get and set data, and Devforce's BOS can serve data as if it was a web service while making sure that no application specific business rules are broken -- IOW, business rules are created and maintained in one place, whether you have a "regular" n-tier app or one developed with Silverlight.

Any comments (good or bad), tips/tricks about the development system in general or major functions in specific?


Thanks!
Pertti Karjalainen
Product Manager
Northern Lights Software
Fairfax, CA USA
www.northernlightssoftware.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform