[Dbix-class] RFC: InflateColumn::FS

Moritz Onken onken at houseofdesign.de
Sat Oct 4 14:01:34 BST 2008


Am 03.10.2008 um 19:37 schrieb Marc Mims:

> * Matt S Trout <dbix-class at trout.me.uk> [081001 18:40]:
>> I'll happily give you svn space for it and we can figure out how to  
>> deprecate
>> IC::File in favour of it later.
>
> Just let me know when you're ready for it and get it into svn.
>
>> Consider $self->ident_values to get the PK values, IIRC.
>
> Looks like it must be $self->_ident_values.  ::PK::id returns:
>
>    (wantarray ? @pk : $pk[0]);
>
> Although, many of the tables I work with have an 'id' column, so I end
> up with an accessor that hides ::PK::id.  It returns the same thing,  
> but
> others might have an 'id' column that is not the PK.
>
> In the interest of making it generic, I should probably not rely on  
> the
> PK being an int, but the directory tree layout currently depends on  
> it,
> and I think it is a reasonably sane default.
>
> Rather than changing the int PK requirement, perhaps anyone wanting
> something different should either use the ::SHA1 subclass or derive
> their own.  Thoughts?
>
> The ::SHA1 subclass, should be able to accommodate any PK type.
> However, I need an algorithm to join the segments of a multi-segment  
> PK
> so it's always unique.  A simple join isn't sufficient:
>
>    'A', 'B'  => 'AB'
>    'AB', ''  => 'AB' # clash

You can SHA each column of the primary key and then SHA the joined SHAs.

SHA(SHA(A).SHA(B)) != SHA(AB);

greets,

moritz



More information about the DBIx-Class mailing list