Skip to content
Snippets Groups Projects
Commit 959a679e authored by Leo Gordon's avatar Leo Gordon
Browse files

bugfix: INSERT_IGNORE is now properly supported

parent 4c1bd8c6
No related branches found
No related tags found
No related merge requests found
......@@ -47,7 +47,7 @@ sub dataflow {
my $table_name = $naked_table->table_name();
my $insertion_method = uc( $naked_table->insertion_method() ); # INSERT, INSERT_IGNORE or REPLACE
$insertion_method =~ s/\s+/_/g;
$insertion_method =~ s/_/ /g;
# By using question marks you can insert true NULLs by setting corresponding values to undefs:
my $sql = "$insertion_method INTO $table_name (".join(', ', keys %$data_hash).') VALUES ('.join(',', (('?') x scalar(keys %$data_hash))).')';
......
......@@ -61,7 +61,7 @@ sub insertion_method {
if(@_) {
$self->{'_insertion_method'} = shift @_;
}
return $self->{'_insertion_method'} || 'INSERT';
return $self->{'_insertion_method'} || 'INSERT_IGNORE';
}
sub url {
......
......@@ -107,7 +107,7 @@ sub fetch {
} else {
return $dba->get_NakedTableAdaptor->create_new(-table_name => $table_name, -insertion_method => $tparam_value || 'INSERT IGNORE');
return $dba->get_NakedTableAdaptor->create_new(-table_name => $table_name, $tparam_value ? (-insertion_method => $tparam_value) : () );
}
}
return;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment