Skip to content

Commit

Permalink
Fix issue on converting boolean values with non default values. Thank…
Browse files Browse the repository at this point in the history
…s to Christian Bjornbak for the report.
  • Loading branch information
darold committed Oct 2, 2013
1 parent 9284fa0 commit 5edc4e5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/Ora2Pg.pm
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ sub _init
}
# additional boolean values given from config file
foreach my $k (keys %{$self->{boolean_values}}) {
$self->{ora_boolean_values}{lc($k)} = $self->{boolean_values}{$k};
$self->{ora_boolean_values}{lc($k)} = $AConfig{BOOLEAN_VALUES}{$k};
}

# Set transaction isolation level
Expand Down Expand Up @@ -5251,7 +5251,9 @@ sub format_data_type
$col = "'$col'";
}
} elsif ($data_type eq 'boolean') {
$col = "'" . ($self->{ora_boolean_values}{lc($col)} || $col) . "'";
if (exists $self->{ora_boolean_values}{lc($col)}) {
$col = "'" . $self->{ora_boolean_values}{lc($col)} . "'";
}
} else {
# covered now by the call to _numeric_format()
# $col =~ s/,/\./;
Expand All @@ -5262,7 +5264,9 @@ sub format_data_type
if (!defined $col) {
$col = '\N';
} elsif ($data_type eq 'boolean') {
$col = ($self->{ora_boolean_values}{lc($col)} || $col);
if (exists $self->{ora_boolean_values}{lc($col)}) {
$col = $self->{ora_boolean_values}{lc($col)};
}
} elsif ($data_type !~ /(char|date|time|text|bytea|xml)/) {
# covered now by the call to _numeric_format()
#$col =~ s/,/\./;
Expand Down Expand Up @@ -5463,7 +5467,7 @@ sub read_config
foreach my $r (@replace_boolean) {
my ($yes, $no) = split(/:/, $r);
$AConfig{$var}{lc($yes)} = 't';
$AConfig{$var}{lc($no)} = 't';
$AConfig{$var}{lc($no)} = 'f';
}
} elsif ($var eq 'DEFINED_PK') {
my @defined_pk = split(/[\s,;\t]+/, $val);
Expand Down

0 comments on commit 5edc4e5

Please sign in to comment.