[Cpan-forum-commit] rev 313 - in trunk: . lib/CPAN/Forum lib/CPAN/Forum/DB lib/CPAN/Forum/RM

svn at pti.co.il svn at pti.co.il
Thu Aug 2 09:24:27 EEST 2007


Author: gabor
Date: 2007-08-02 09:24:27 +0300 (Thu, 02 Aug 2007)
New Revision: 313

Modified:
   trunk/
   trunk/lib/CPAN/Forum/DB/Subscriptions_all.pm
   trunk/lib/CPAN/Forum/DBI.pm
   trunk/lib/CPAN/Forum/RM/Subscriptions.pm
Log:
mypan updating the ALL subscription correctly now



Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4341
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752
   + 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4370
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752

Modified: trunk/lib/CPAN/Forum/DB/Subscriptions_all.pm
===================================================================
--- trunk/lib/CPAN/Forum/DB/Subscriptions_all.pm	2007-07-29 05:36:19 UTC (rev 312)
+++ trunk/lib/CPAN/Forum/DB/Subscriptions_all.pm	2007-08-02 06:24:27 UTC (rev 313)
@@ -51,7 +51,9 @@
     my @fields = keys %$args;
 
     my $where = join ", ", map {"$_=?"} @fields;
-    return ($where, @{ $args->{@fields} }); 
+    my %args = %$args;
+    return ($where, @args{@fields}); 
+    #return ($where, @{ $args->{@fields} }); 
 }
 
 sub _prep_insert {

Modified: trunk/lib/CPAN/Forum/DBI.pm
===================================================================
--- trunk/lib/CPAN/Forum/DBI.pm	2007-07-29 05:36:19 UTC (rev 312)
+++ trunk/lib/CPAN/Forum/DBI.pm	2007-08-02 06:24:27 UTC (rev 313)
@@ -138,7 +138,7 @@
 sub _complex_update {
     my ($self, $where, $on, $data, $table) = @_;
     if ($on) {
-        my $s = $self->find_one($table, %$where);
+        my $s = $self->find_one(%$where);
         if ($s) {
             $self->update($table, $where, $data);
         } else {
@@ -153,8 +153,9 @@
 
 sub add {
     my ($self, $table, $args) = @_;
+    # check if $table is one of the subscription tables?
     my ($fields, $placeholders, @values) = $self->_prep_insert($args);
-    my $sql = "INSERT INTO subscriptions_all ($fields) VALUES($placeholders)";
+    my $sql = "INSERT INTO $table ($fields) VALUES($placeholders)";
     my $dbh = CPAN::Forum::DBI::db_Main();
     $dbh->do($sql, undef, @values);
     return;
@@ -163,10 +164,11 @@
 
 sub update {
     my ($self, $table, $args, $data) = @_;
+    # check if $table is one of the subscription tables?
     my ($where, @values)   = $self->_prep_where($args);
     Carp::croak("") if not $where;
     my ($set, @new_values) = $self->_prep_set($data);
-    my $sql = "UPDATE subscriptions_all $set $where";
+    my $sql = "UPDATE $table SET $set WHERE $where";
     my $dbh = CPAN::Forum::DBI::db_Main();
     $dbh->do($sql, undef, @new_values, @values);
     return;

Modified: trunk/lib/CPAN/Forum/RM/Subscriptions.pm
===================================================================
--- trunk/lib/CPAN/Forum/RM/Subscriptions.pm	2007-07-29 05:36:19 UTC (rev 312)
+++ trunk/lib/CPAN/Forum/RM/Subscriptions.pm	2007-08-02 06:24:27 UTC (rev 313)
@@ -157,6 +157,7 @@
         my ($on, $data) = $self->_get_subs($gid);
 
         if ($gid eq "_all") {
+            $self->log->debug("Subscription_all: '$uid', '$on', " . Data::Dumper->Dump([$data], ['data']));
             CPAN::Forum::DB::Subscriptions_all->complex_update({uid => $uid}, $on, $data);
         } elsif ($gid =~ /^_(\d+)$/) {
             my $pauseid = $1;



More information about the Cpan-forum-commit mailing list