[Dbix-class] bit varying columns
Bill Moseley
moseley at hank.org
Thu Oct 23 21:19:37 GMT 2014
What's a good way to work with "bit varying" columns? I want to toggle
bits and set values.
__PACKAGE__->add_columns( my_bits => { data_type => 'bit varying', } );
$foo->my_bits returns a string (e.g. "0000101010101" ).
I can do something like this to set a bit, but I assume there's a cleaner
way:
my $new_bits = 2 | oct( '0b' . $foo->my_bits );
my $bit_str = sprintf '%b', $new_bits;
$foo->update( { my_bits => \"B'$bit_str'" } );
Seems like inflating to the integer (or Bit::Vector?) would be cleaner.
Suggestions?
--
Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20141023/09fe6e65/attachment.htm>
More information about the DBIx-Class
mailing list