Re: uniqid() and repetition of numbers generated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 9:11 AM +1000 11/13/09, Angus Mann wrote:
Thanks Ashley. To clarify, the reason I don't want to use auto-increment : different users with their own populated databases may wish to merge some or all of their data. The unique identifier needs to be carried along with the rest of the data, hence be unique not only on the database it currently resides in ... it still needs to be unique if it gets copied into another person's database, and auto-increment will not meet that requirement.


What you are running into can be solved with proper application of namespace and auto-increment. It's a problem that's been solved.

If you want something unique per database, then use the domain name where the database resides.

That way when you merge two database together, they field could have their on internal auto-increment that is guaranteed to be unique and a field showing their domain name, which is also unique.

If using a domain name (i.e., string) doesn't fit with your design, then where you merge databases together then have an assignment of numbers to each domain in the parent database. For example;

example.com = 1
nowhere.com = 2
hereitis.com = 3
...

Then in your merged database you would have the following two fields

domain number |  auto-increment number (specific for that domain)
231 | 459879
356 | 109374556
140847 | 456729

That way you can have a nearly unlimited number of databases each contributing a nearly unlimited number of records. What more could you want?

Remember, the IP's are 255 x 255 x 255 x 255 < that's a pretty big number.

If that doesn't solve your problem, then use the IPng, which is

4 billion x 4 billion x 4 billion x 4 billion.

That's a number 36 digits long.

To give you an idea of how large that number is, imagine the surface of this planet divided into atoms and each atom having a billion addresses assigned to it.

So, simplify your problem by using namespace and auto-increment -- it works.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux