[Affelio-cvs 1095] CVS update: affelio/apps/diary/upgrade

Back to archive index

Yoshihisa Fukuhara higef****@users*****
2006年 3月 1日 (水) 16:54:19 JST


Index: affelio/apps/diary/upgrade/index.cgi
diff -u affelio/apps/diary/upgrade/index.cgi:1.2 affelio/apps/diary/upgrade/index.cgi:1.3
--- affelio/apps/diary/upgrade/index.cgi:1.2	Wed Mar  1 15:32:25 2006
+++ affelio/apps/diary/upgrade/index.cgi	Wed Mar  1 16:54:19 2006
@@ -160,9 +160,9 @@
    ################################
     #Update tables
     ################################
-    update_table($dbh, $entry_table, 'c_id', "1", "NULL", "INTEGER");
-    update_table($afap->{af}->getDB, "AFuser_CORE_apps", 'guest_index', "index.cgi", "list_diary.cgi", "TEXT","app_name","diary");
-    update_table($afap->{af}->getDB, "AFuser_CORE_apps", 'owner_index', "admin.cgi", "owner.cgi", "TEXT","app_name","diary");
+    update_table($dbh, $entry_table, "c_id", "1", "NULL", "INTEGER");
+    update_table($afap->{af}->getDB, "AFuser_CORE_apps", "guest_index", "index.cgi", "list_diary.cgi", "TEXT","app_name","diary");
+    update_table($afap->{af}->getDB, "AFuser_CORE_apps", "owner_index", "admin.cgi", "owner.cgi", "TEXT","app_name","diary");
 
     print "Done.<BR>";
 
@@ -219,32 +219,37 @@
 
     my $query;
     if ($type eq "INTEGER"){
-	$query = "SELECT $col from $table WHERE $col = $current";
+	$query = "SELECT * from $table WHERE $col = $current";
     }else{
-	$query = "SELECT $col from $table WHERE $col = '$current'";
+	$query = "SELECT * from $table WHERE $col = '$current'";
     }
     if ($col2 ne "" && $current2 ne""){
 	$query.= " AND $col2 = '$current2'";
     }
-    print $query;
+#    print $query;
     my $sth;
-    my $ret;
     eval{
 	$sth = $dbh->prepare($query);
-	$ret = $sth->execute;
+	$sth->execute;
     };
-    print $ret;
-    if($ret>0){
+    my $row=0;
+    while(my @tmp= $sth->fetchrow_array){
+	$row++;
+    }
+    $sth->finish;
+
+    if($row>0){
 	my $query2;
 	print "We confirmed that table [$table] needs update [$col]<BR>";
 	if ($type eq "INTEGER"){
-	    $query2 = "UPDATE $table SET Scol = $value WHERE $col = $current";
+	    $query2 = "UPDATE $table SET $col = $value WHERE $col = $current";
 	}else{
-	    $query2 = "UPDATE $table SET Scol = '$value' WHERE $col = '$current'";
+	    $query2 = "UPDATE $table SET $col = '$value' WHERE $col = '$current'";
 	}
 	if ($col2 ne "" && $current2 ne""){
 	    $query2.= " AND $col2 = '$current2'";
 	}
+#    print $query2;
 	my $sth;
 	eval{
 	    $dbh->do($query2);


Affelio-cvs メーリングリストの案内
Back to archive index