| 1 | package Protocol::Database::PostgreSQL::Backend::CopyData; | ||||||||||
| 2 | |||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 4 | our $VERSION = '2.000'; # VERSION | |||||||||
| 7 | |||||||||||
| 8 | 4 | ▶ | use parent qw(Protocol::Database::PostgreSQL::Backend); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | =head1 NAME | ||||||||||
| 11 | |||||||||||
| 12 | Protocol::Database::PostgreSQL::Backend::CopyData | ||||||||||
| 13 | |||||||||||
| 14 | =head1 DESCRIPTION | ||||||||||
| 15 | |||||||||||
| 16 | =cut | ||||||||||
| 17 | |||||||||||
| 18 | 4 | ▶ | use Log::Any qw($log); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | |||||||||||
| 20 | 0 | ▶ | sub type { 'copy_data' } | ||||||||
|
Subroutine
type: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 21 | |||||||||||
| 22 | 0 | ▶ | sub rows { shift->{rows}->@* } | ||||||||
|
Subroutine
rows: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 23 | |||||||||||
| 24 | 4 | my %_charmap = reverse( | |||||||||
| 25 | "\\" => "\\\\", | ||||||||||
| 26 | "\x08" => "\\b", | ||||||||||
| 27 | "\x09" => "\\t", | ||||||||||
| 28 | "\x0A" => "\\r", | ||||||||||
| 29 | "\x0C" => "\\f", | ||||||||||
| 30 | "\x0D" => "\\n", | ||||||||||
| 31 | ); | ||||||||||
| 32 | |||||||||||
| 33 | sub new_from_message { | ||||||||||
| 34 | 0 | ▶ | my ($class, $msg) = @_; | ||||||||
|
Subroutine
new_from_message: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 35 | 0 | my $data = substr $msg, 5; | |||||||||
| 36 | 0 | $log->tracef('COPY data is %s', $data); | |||||||||
| 37 | my @rows = map { | ||||||||||
| 38 | 0 | [ | |||||||||
| 39 | map { | ||||||||||
| 40 | 0 | ▶ | $_ eq '\N' | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | ? undef | ||||||||||
| 42 | 0 | : s/(\\[\\btrfn])/$_charmap{$1}/ger | |||||||||
| 43 | } split /\t/ | ||||||||||
| 44 | ] | ||||||||||
| 45 | } split /\n/, $data; | ||||||||||
| 46 | 0 | return $class->new( | |||||||||
| 47 | rows => \@rows, | ||||||||||
| 48 | # data_format => $data_format, | ||||||||||
| 49 | # count => $count, | ||||||||||
| 50 | # formats => \@formats | ||||||||||
| 51 | ); | ||||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 4 | 1; | |||||||||
| 55 | |||||||||||
| 56 | =head1 AUTHOR | ||||||||||
| 57 | |||||||||||
| 58 | Tom Molesworth <TEAM@cpan.org> | ||||||||||
| 59 | |||||||||||
| 60 | =head1 LICENSE | ||||||||||
| 61 | |||||||||||
| 62 | Copyright Tom Molesworth 2010-2019. Licensed under the same terms as Perl itself. | ||||||||||
| 63 | |||||||||||