From: Dagfinn Ilmari Mannsåker Date: Tue, 29 Nov 2011 16:40:09 +0000 (+0000) Subject: Use numeric format for bigint columns X-Git-Tag: v0.02002~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5da3e14747f34ab3fccb870e513f0b0ae762851f;p=dbsrgits%2FDBIx-Class-InflateColumn-IP.git Use numeric format for bigint columns Use bigint column in test to cope with DBD::SQLite bind type changes. --- diff --git a/Changes b/Changes index 7fb9b91..b9d75c6 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for DBIx::Class::InflateColumn::IP + - Use numeric format for bigint columns. + - Use bigint column in test to cope with DBD::SQLite bind type changes. + 0.02001 Sun Jun 17 20:27:34 2007 - Initial version of format autodetection, based solely on column type. diff --git a/lib/DBIx/Class/InflateColumn/IP.pm b/lib/DBIx/Class/InflateColumn/IP.pm index ba4a3d5..a37dfa1 100644 --- a/lib/DBIx/Class/InflateColumn/IP.pm +++ b/lib/DBIx/Class/InflateColumn/IP.pm @@ -22,7 +22,7 @@ appropriate format. __PACKAGE__->load_components(qw/InflateColumn::IP Core/); __PACKAGE__->add_columns( ip_address => { - data_type => 'integer', + data_type => 'bigint', is_nullable => 0, is_ip => 1, ip_format => 'numeric', @@ -48,8 +48,9 @@ Then you can treat the specified column as a NetAddr::IP object. DBIx::Class::InflateColumn::IP supports a limited amount of auto-detection of the format based on the column type. If the type -begins with C, it's assumed to be numeric, while C and -C (as used by e.g. PostgreSQL) are assumed to be C format. +begins with C or C, it's assumed to be numeric, while +C and C (as used by e.g. PostgreSQL) are assumed to be +C format. =head1 METHODS @@ -109,7 +110,7 @@ sub register_column { } my @format_map = ( - { type => qr/^int/i, format => 'numeric' }, + { type => qr/^(?:big)?int/i, format => 'numeric' }, { type => qr{^(?:inet|cidr)$}i, format => 'cidr' }, ); diff --git a/t/lib/DBICTest/Schema/Host.pm b/t/lib/DBICTest/Schema/Host.pm index 5f1d99f..53ee9f7 100644 --- a/t/lib/DBICTest/Schema/Host.pm +++ b/t/lib/DBICTest/Schema/Host.pm @@ -12,7 +12,7 @@ __PACKAGE__->add_columns( is_nullable => 0, }, address => { - data_type => 'integer', + data_type => 'bigint', is_nullable => 0, is_ip => 1, }