Skip to content

Commit

Permalink
producer Dumper: fix NULL handling for strings
Browse files Browse the repository at this point in the history
  • Loading branch information
eserte committed Nov 23, 2023
1 parent 39e00ab commit d77db84
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/SQL/Translator/Producer/Dumper.pm
Original file line number Diff line number Diff line change
Expand Up @@ -232,17 +232,13 @@ for my $table ( @tables ) {
my @vals;
for my $fld ( @{ $table->{'fields'} } ) {
my $val = $rec->{ $fld };
if ( $table->{'types'}{ $fld } eq 'string' ) {
if ( defined $val ) {
if ( defined $val ) {
if ( $table->{'types'}{ $fld } eq 'string' ) {
$val =~ s/'/\\'/g;
$val = qq['$val']
}
else {
$val = qq[''];
}
}
else {
$val = defined $val ? $val : $mysql_loadfile ? '\N' : 'NULL';
} else {
$val = $mysql_loadfile ? '\N' : 'NULL';
}
push @vals, $val;
}
Expand Down

0 comments on commit d77db84

Please sign in to comment.