my$primary_key=$self->primary_key();# Attention: the order of primary_key columns of your call should match the order in the table definition!
if(@$primary_key){
returnjoin(' AND ',map{$primary_key->[$_]."='".$_[$_]."'"}(0..scalar(@$primary_key)-1));
returnjoin(' AND ',map{$primary_key->[$_]."='".$sliceref->[$_]."'"}(0..scalar(@$primary_key)-1));
}else{
my$table_name=$self->table_name();
die"Table '$table_name' doesn't have a primary_key";
...
...
@@ -245,9 +246,12 @@ sub update { # update (some or all) non_primary columns from the primary
die"There are no dependent columns to update, as everything seems to belong to the primary key";
}
my$sql="UPDATE $table_name SET ".join(', ',map{"$columns_to_update->[$_]=$values_to_update->[$_]"}(0..@$columns_to_update-1))." WHERE $primary_key_constraint";
my$sql="UPDATE $table_name SET ".join(', ',map{"$_=?"}@$columns_to_update)." WHERE $primary_key_constraint";