Lines 406-411
sub TO_JSON {
Link Here
|
406 |
and looks_like_number( $unblessed->{$col} ) |
406 |
and looks_like_number( $unblessed->{$col} ) |
407 |
) { |
407 |
) { |
408 |
|
408 |
|
|
|
409 |
if ( $self->{_redact} ) { |
410 |
$unblessed->{$col} = 0; |
411 |
} |
412 |
|
409 |
# TODO: Remove once the solution for |
413 |
# TODO: Remove once the solution for |
410 |
# https://github.com/perl5-dbi/DBD-mysql/issues/212 |
414 |
# https://github.com/perl5-dbi/DBD-mysql/issues/212 |
411 |
# is ported to whatever distro we support by that time |
415 |
# is ported to whatever distro we support by that time |
Lines 415-420
sub TO_JSON {
Link Here
|
415 |
elsif ( _decimal_column_type( $columns_info->{$col}->{data_type} ) |
419 |
elsif ( _decimal_column_type( $columns_info->{$col}->{data_type} ) |
416 |
and looks_like_number( $unblessed->{$col} ) |
420 |
and looks_like_number( $unblessed->{$col} ) |
417 |
) { |
421 |
) { |
|
|
422 |
if ( $self->{_redact} ) { |
423 |
$unblessed->{$col} = 0.00; |
424 |
} |
418 |
|
425 |
|
419 |
# TODO: Remove once the solution for |
426 |
# TODO: Remove once the solution for |
420 |
# https://github.com/perl5-dbi/DBD-mysql/issues/212 |
427 |
# https://github.com/perl5-dbi/DBD-mysql/issues/212 |
Lines 423-428
sub TO_JSON {
Link Here
|
423 |
$unblessed->{$col} += 0.00; |
430 |
$unblessed->{$col} += 0.00; |
424 |
} |
431 |
} |
425 |
elsif ( _datetime_column_type( $columns_info->{$col}->{data_type} ) ) { |
432 |
elsif ( _datetime_column_type( $columns_info->{$col}->{data_type} ) ) { |
|
|
433 |
if ( $self->{_redact} ) { |
434 |
$unblessed->{$col} = "0000-01-01 00:00:01"; |
435 |
} |
426 |
eval { |
436 |
eval { |
427 |
return unless $unblessed->{$col}; |
437 |
return unless $unblessed->{$col}; |
428 |
$unblessed->{$col} = output_pref({ |
438 |
$unblessed->{$col} = output_pref({ |
Lines 431-436
sub TO_JSON {
Link Here
|
431 |
}); |
441 |
}); |
432 |
}; |
442 |
}; |
433 |
} |
443 |
} |
|
|
444 |
elsif ( $self->{_redact} ) { |
445 |
$unblessed->{$col} = '*****'; |
446 |
} |
434 |
} |
447 |
} |
435 |
return $unblessed; |
448 |
return $unblessed; |
436 |
} |
449 |
} |
Lines 552-558
Returns a representation of the object, suitable for API output.
Link Here
|
552 |
sub to_api { |
565 |
sub to_api { |
553 |
my ( $self, $params ) = @_; |
566 |
my ( $self, $params ) = @_; |
554 |
|
567 |
|
555 |
return unless $self->is_accessible($params); |
568 |
unless ( $self->is_accessible($params) ) { |
|
|
569 |
$self->{_redact} = 1; |
570 |
} |
556 |
|
571 |
|
557 |
my $json_object = $self->TO_JSON; |
572 |
my $json_object = $self->TO_JSON; |
558 |
|
573 |
|