+sub delete {
+ $main::lxdebug->enter_sub();
+
+ my $self = shift;
+ my %params = @_;
+
+ Common::check_params(\%params, [ qw(from_table from_id to_table to_id) ]);
+
+ my $myconfig = \%main::myconfig;
+ my $form = $main::form;
+
+ SL::DB->client->with_transaction(sub {
+ my $dbh = $params{dbh} || SL::DB->client->dbh;
+
+ # content
+ my (@where_tokens, @where_values);
+
+ for my $col (qw(from_table from_id to_table to_id)) {
+ add_token(\@where_tokens, \@where_values, col => $col, val => $params{$col}) if $params{$col};
+ }
+
+ my $where = @where_tokens ? "WHERE ". join ' AND ', map { "($_)" } @where_tokens : '';
+ my $query = "DELETE FROM record_links $where";
+
+ do_query($form, $dbh, $query, @where_values);
+
+ 1;
+ }) or die { SL::DB->client->error };
+
+ $main::lxdebug->leave_sub();
+}
+