Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6310

Re: Is spl_object_hash unique in the SQL sense? Can it be used as a unique SQL db column?

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: Is spl_object_hash unique in the SQL sense? Can it be used as a unique SQL db column?
Date 2012-06-12 15:06 -0400
Organization A noiseless patient Spider
Message-ID <jr840g$que$2@dont-email.me> (permalink)
References <b3a88b31-765b-4537-adfd-563c4734c66a@googlegroups.com> <jr627b$aqj$1@dont-email.me> <a3acc71e-a388-47ed-97c5-72f4d04c40e5@googlegroups.com>

Show all headers | View raw


On 6/12/2012 2:47 PM, kurtk@pobox.com wrote:
>> No, hashes can never guaranteed to be unique.
>
> I opted to use
>
>    md5(uniqid());
>
> to create a unique key.
>

Still not guaranteed to be unique.  Hashes never are.  But if you've 
only got a few thousand items, the chances of a collision are slim.

This is why databases have sequence or auto-increment values.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Is spl_object_hash unique in the SQL sense? Can it be used as a unique SQL db column? "kurtk@pobox.com" <kurtk@pobox.com> - 2012-06-11 17:16 -0700
  Re: Is spl_object_hash unique in the SQL sense? Can it be used as a unique SQL db column? Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-11 20:24 -0400
    Re: Is spl_object_hash unique in the SQL sense? Can it be used as a unique SQL db column? "kurtk@pobox.com" <kurtk@pobox.com> - 2012-06-12 11:47 -0700
      Re: Is spl_object_hash unique in the SQL sense? Can it be used as a unique SQL db column? Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-12 15:06 -0400
      Re: Is spl_object_hash unique in the SQL sense? Can it be used as a unique SQL db column? "Peter H. Coffin" <hellsop@ninehells.com> - 2012-06-12 14:26 -0500
        Re: Is spl_object_hash unique in the SQL sense? Can it be used as a unique SQL db column? Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-12 19:34 -0400
      Re: Is spl_object_hash unique in the SQL sense? Can it be used as a unique SQL db column? Captain Paralytic <paul_lautman@yahoo.com> - 2012-06-13 04:09 -0700
        Re: Is spl_object_hash unique in the SQL sense? Can it be used as a   unique SQL db column? Goran <goran@nospam.com> - 2012-06-13 13:40 +0200
          Re: Is spl_object_hash unique in the SQL sense? Can it be used as a unique SQL db column? Captain Paralytic <paul_lautman@yahoo.com> - 2012-06-19 03:32 -0700

csiph-web