Op 2011-03-08 01:33, Martin het geskryf:
There are good solutions in the middle.
Indeed, there are many alternative solutions. We simply use GUID's via CreateGUID() and GUIDToString(), then strip off the outer braces and remove the hyphens. This reduces the GUID from 38 characters down to 32 characters. Others only strip off the outer braces. Our ID generator does all this for us, we simply need to request a new object instance.
tiOPF also implements the Ambler high/low method, plus a few others. The Ambler high/low method greatly reduces the amount of server round-trips. eg: a client requests a new ID from the server. A table gets updated with the last used number. The return value is the previous last used number plus one. The result is actually a range of ID's (configurable in size), say the next 30 sequential numbers. So while the client needs to generate ID's, it doesn't need to query the server for at least the next 30 id's.
Depending on how you look at it, this might have some negative points though. This will result in gaps of unused numbers. Data will also not be in a 100% correct creation order etc.
So again, it's up to a company to evaluate what ID generating process works best for them, how portable those methods are between RDBMS etc.
Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
