Re: uniqid() and repetition of numbers generated
| From: | Ross McKay | Date: | Thu, 12 Nov 2009 23:37:44 +0000 |
| Subject: | Re: uniqid() and repetition of numbers generated | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-299800@lists.php.net to get a copy of this message | ||
On Fri, 13 Nov 2009 08:22:47 +1000, Angus Mann wrote:
>I need a unique identifier in an SQL table and for complicated reasons
>I don't want to use auto-increment. [...]
So why not use a UUID/GUID as created by the DB? You don't specify which
DB server technology you're using, but:
* Microsoft SQL Server has uniqueidentifier and newid()
* Oracle has sys_guid()
* MySQL has uuid() and uuid_short()
* PostgreSQL has uuid and contributor function contrib/uuid-ossp
Or are you using something else which doesn't support UUIDs?
(Ash, maybe he's doing replication and can't rely on auto-increment
integers aligning across peers)
--
Ross McKay, Toronto, NSW Australia
"Let the laddie play wi the knife - he'll learn"
- The Wee Book of Calvin