Revision 762
- Date:
- 2019/01/23 17:08:33
- Files:
Legend:
- Added
- Removed
- Modified
-
utf8/core/lib/Contenido/Object.pm
25 25 26 26 use DBD::Pg; 27 27 use Encode; 28 use version; 28 29 29 30 use SQL::ProtoTable; 30 31 … … 313 314 $extra_fields = ${$self->{class}.'::extra_fields'}; 314 315 $virtual_fields = ${$self->{class}.'::virtual_fields'}; 315 316 #надо использовать все extra поля кроме тех что находятся в virtual_fields списке 317 warn "DBD-Pg: ".$DBD::Pg::VERSION.", Perl version: ".$]."\n" if $DEBUG; 316 318 if ($state->db_encode_data) { 317 319 return Encode::decode('utf-8', $json_n->encode ({map { $_=> Encode::decode($state->db_encode_data, $self->{$_}, Encode::FB_HTMLCREF) } grep { !$virtual_fields->{$_} && (defined $self->{$_}) } @$extra_fields})); 318 } elsif ( $DBD::Pg::VERSION >= '3' && $] < '5.026' ) { 320 } elsif ( version->parse($DBD::Pg::VERSION) >= '3' && $] < '5.026' ) { 319 321 return Encode::decode('utf-8', $json_n->encode ({map { $_=>$self->{$_} } grep { !$virtual_fields->{$_} && (defined $self->{$_}) } @$extra_fields})); 320 322 } else { 321 323 return $json_n->encode( {map { $_=>$self->{$_} } grep { !$virtual_fields->{$_} && (defined $self->{$_}) } @$extra_fields} ); … … 330 332 local $Data::Dumper::Indent = 0; 331 333 if ($state->db_encode_data) { 332 334 return Data::Dumper::Dumper({map { $_=> Encode::decode($state->db_encode_data, $self->{$_}, Encode::FB_HTMLCREF) } grep { !$virtual_fields->{$_} && (defined $self->{$_}) } @$extra_fields}); 333 } elsif ( $DBD::Pg::VERSION >= '3' && $] < '5.026' ) { 335 } elsif ( version->parse($DBD::Pg::VERSION) >= '3' && $] < '5.026' ) { 334 336 return Encode::decode( 'utf-8', Data::Dumper::Dumper({map { $_=>$self->{$_} } grep { !$virtual_fields->{$_} && (defined $self->{$_}) } @$extra_fields}) ); 335 337 } else { 336 338 return Data::Dumper::Dumper({map { $_=>$self->{$_} } grep { !$virtual_fields->{$_} && (defined $self->{$_}) } @$extra_fields}); … … 462 464 my ($query, $binds) = $table->generate_sql(%opts); 463 465 my @binds = (); 464 466 467 warn "DBD-Pg: ".$DBD::Pg::VERSION.", Perl version: ".$]."\n" if $DEBUG; 465 468 if ($state->db_encode_data) { 466 469 foreach my $i (0..$#{$binds}) { 467 470 if ( ref $binds->[$i] ) { … … 470 473 $binds->[$i] = Encode::decode($state->db_encode_data, $binds->[$i], Encode::FB_HTMLCREF); 471 474 } 472 475 } 473 } elsif ( $DBD::Pg::VERSION >= '3' ) { 476 } elsif ( version->parse($DBD::Pg::VERSION) > version->parse('3') && version->parse($DBD::Pg::VERSION) < version->parse('3.7.0') ) { 474 477 foreach my $i (0..$#{$binds}) { 475 478 if ( ref $binds->[$i] ) { 476 479 $binds->[$i] = Data::Recursive::Encode->decode_utf8($binds->[$i]);