diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-05-03 19:43:00 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-05-13 11:53:24 +0100 |
commit | 0796a2b6821e75e22ec6eacd3950ef916b16303d (patch) | |
tree | b37dfe49b5cfbd1be9528bc8ed9fa5667b1be7d0 /perllib/FixMyStreet/DB/RABXColumn.pm | |
parent | c65c2bc48abce71bca97079ffdb7aa39d5b7e8ed (diff) |
Update a number of packages.
Update:
* Catalyst
* Specify Catalyst::DispatchType::Regex explicitly
* Remove Catalyst::Plugin::Unicode::Encoding
* Catalyst::Plugin::SmartURI
* Specify URI::SmartURI explicitly
* Catalyst::Plugin::Static::Simple
* CGI
* Class::Load
* DateTime
* DateTime::TimeZone
* DBD::Pg
* DBIx::Class
* DBIx::Class::EncodedColumn.
* Email::Address.
* Email::MIME
* ExtUtils::MakeMaker
* ExtUtils::ParseXS (for Params::Classify upgrade)
* File::ChangeNotify
* Image::Size
* IO::Socket::SSL
* local::lib
* Moo
* Moose (and some related others due to deprecations)
* namespace::autoclean
* Net::Server
* Net::SSLeay
* Number::Phone
* Plack
* Starman
* Template
* Test::PostgreSQL
* Test::WWW::Mechanize::Catalyst
* Text::CSV
* YAML
carton install was run on a wheezy box, the oldest that is supported, to
make sure the required minimal vesions of core modules weren't removed
from the snapshot. Cpanel::JSON::XS, Devel::GlobalDestruction::XS, and
MooseX::NonMoose were then put back in the snapshot, in case another
system needs them (e.g. system Perl on Mac looks for MooseX::NonMoose).
Diffstat (limited to 'perllib/FixMyStreet/DB/RABXColumn.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/RABXColumn.pm | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/perllib/FixMyStreet/DB/RABXColumn.pm b/perllib/FixMyStreet/DB/RABXColumn.pm index d14b48dc8..76eb21030 100644 --- a/perllib/FixMyStreet/DB/RABXColumn.pm +++ b/perllib/FixMyStreet/DB/RABXColumn.pm @@ -52,6 +52,8 @@ set_filtered_column behaviour to not trust the cache. sub rabx_column { my ($class, $col) = @_; + my $data_type = $class->column_info($col)->{data_type}; + # Apply the filtering for this column $class->filter_column( $col => { @@ -59,6 +61,10 @@ sub rabx_column { my $self = shift; my $ser = shift; return undef unless defined $ser; + # Some RABX columns are text, when they should be bytea. For + # these we must re-encode the string returned from the + # database, so that it is decoded again by RABX. + utf8::encode($ser) if $data_type ne 'bytea'; my $h = new IO::String($ser); return RABX::wire_rd($h); }, @@ -68,6 +74,10 @@ sub rabx_column { my $ser = ''; my $h = new IO::String($ser); RABX::wire_wr( $data, $h ); + # Some RABX columns are text, when they should be bytea. For + # these, we must re-decode the string encoded by RABX, so that + # it is encoded again when saved to the db. + utf8::decode($ser) if $data_type ne 'bytea'; return $ser; }, } @@ -77,14 +87,6 @@ sub rabx_column { $RABX_COLUMNS{ _get_class_identifier($class) }{$col} = 1; } -# The underlying column should always be UTF-8 encoded bytes. -sub get_column { - my ($self, $col) = @_; - my $res = $self->next::method ($col); - utf8::encode($res) if $RABX_COLUMNS{_get_class_identifier($self)}{$col} && utf8::is_utf8($res); - return $res; -} - sub set_filtered_column { my ($self, $col, $val) = @_; |