Re: Adding new datatypes for attributes
[prev]
[thread]
[next]
[Date index for 2004/07/30]
Aaron Trevena wrote:
> Anyway, I was hoping somebody could point me in the right direction to
> adding some extra datatypes for attributes so that an attributed could
> be a list, or a vector/bitmap or an enum or a storable binary.
>
> I am guessing any users of these types will have to specify to use
> these types, rather than determine them on the fly (although that
> would be useful and cool), but I don't see where I could hack them in.
> There is a nice way of adding new relationships which is cool and I
> was hoping that even if there isn't something similar for datatypes
> there might be a starting point to work from.
If all you want is to identify various columns as a particular datatype, then
you could just use column groups, like so:
Widget->columns(Integer => qw/num1 num2 num3/);
Widget->columns(Float => qw/floatone floattwo floatthree floatfour/);
Widget->columns(Char => qw/first_name middle_name last_name/);
Check out the Class::DBI::ColumnGrouper docs. You access the ColumnGrouper
object using
Widget->__grouper
Despite that CDBI method being preceded by two underscores, it's safe to use
this interface. Tony says:
>> [...] the next version of Class::DBI will probably have a little less
>> intimidating access to the Grouper. I'd rather not just keep adding
>> delegation methods to it if we can just make it public itself for people
>> who really need it. The private accessor to it will keep working for a
>> while (probably with a deprecated warning) so you can safely use it for
>> now without risking its sudden disappearance)
|
|
Re: Adding new datatypes for attributes
Edward J. Sabol 14:57 on 30 Jul 2004
|