Index: openacs-4/packages/news-aggregator/tcl/subscription-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/subscription-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/news-aggregator/tcl/subscription-procs.tcl 29 Jun 2018 17:27:19 -0000 1.2 +++ openacs-4/packages/news-aggregator/tcl/subscription-procs.tcl 18 Jul 2018 14:08:49 -0000 1.3 @@ -13,16 +13,34 @@ {-aggregator_id:required} {-source_id:required} } { - if { ![db_string subscription_exists_p {} -default "0"] } { - db_dml insert_subscription {} + if {![db_string subscription_exists_p { + select exists (select 1 from na_subscriptions + where aggregator_id = :aggregator_id + and source_id = :source_id) + }]} { + db_dml insert_subscription { + insert into na_subscriptions ( + aggregator_id, + source_id, + creation_date + ) values ( + :aggregator_id, + :source_id, + current_timestamp + ) + } } } ad_proc -public news_aggregator::subscription::delete { {-source_id:required} {-aggregator_id:required} } { - db_dml delete_subscription {} + db_dml delete_subscription { + delete from na_subscriptions + where source_id = :source_id + and aggregator_id = :aggregator_id + } } ad_proc -public news_aggregator::subscription::move { @@ -35,7 +53,12 @@ @author Simon Carstensen @creation-date 2003-08-23 } { - db_dml move_subscription {} + db_dml move_subscription { + update na_subscriptions set + aggregator_id = :move_to + where source_id = :source_id + and aggregator_id = :move_from + } } ad_proc -public news_aggregator::subscription::copy { @@ -47,5 +70,7 @@ @author Simon Carstensen @creation-date 2003-08-23 } { - db_dml copy_subscription {} + news_aggregator::subscription::new \ + -aggregator_id $copy_to \ + -source_id $source_id }