2010/10/7 Jes Gabriel y Gal <jgabrielygalan / gmail.com>:
> On Thu, Oct 7, 2010 at 2:54 PM, Jim Burgess <jack.zelig / gmail.com> wrote:
>> I have a large array and want to calculate its hash-code using
>> Array#hash.
>>
>> i.e. ["a","b","c"].hash
>>
>> I want to store this hash-code in a database table.
>>
>> Can anyone tell me (or point me in the right direction to find out), the
>> maximum length (in characters) of such a hash-code.
>>
>> On my development machine the hash-code is always small enough to fit
>> into a int(11) field, but I don't know what factors influence its
>> calculation.
>>
>> Thanks in advance.
>
> This:
> http://ruby-doc.org/core/classes/Array.html#M002159
>
> says that Array#hash returns a Fixnum, and this:
>
> http://ruby-doc.org/core/classes/Fixnum.html#M001079
>
> Tells you the size in bytes of a Fixnum in your platform.

Having said that, what's the point in storing a hash code in a
database table?  Basically this is redundant information and when
querying you would want to check for the key fields anyway because
hash codes are by far not unique.  So the hash code is not helpful
during querying.  Jim, what's the point?

Kind regards

robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/