[Slashdotjp-dev 917] [435] Fix: duplicate key error at plugin/Stats/Stats.pm

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
2008年 1月 20日 (日) 02:11:13 JST


Revision: 435
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=435
Author:   tach
Date:     2008-01-20 02:11:13 +0900 (Sun, 20 Jan 2008)

Log Message:
-----------
Fix: duplicate key error at plugin/Stats/Stats.pm

Modified Paths:
--------------
    slashjp/trunk/debian/changelog
    slashjp/trunk/plugins/Stats/Stats.pm


-------------- next part --------------
Modified: slashjp/trunk/debian/changelog
===================================================================
--- slashjp/trunk/debian/changelog	2008-01-18 09:43:52 UTC (rev 434)
+++ slashjp/trunk/debian/changelog	2008-01-19 17:11:13 UTC (rev 435)
@@ -2,8 +2,9 @@
 
   * Add logcheck ignore rules
     - Suppress harmless messages about freshen.pl
+  * Fix: duplicate key error at plugin/Stats/Stats.pm
 
- -- Taku YASUI <tach****@osdn*****>  Fri, 18 Jan 2008 18:42:24 +0900
+ -- Taku YASUI <tach****@debia*****>  Sun, 20 Jan 2008 02:09:28 +0900
 
 slash (2.5.0.189-1) unstable; urgency=low
 

Modified: slashjp/trunk/plugins/Stats/Stats.pm
===================================================================
--- slashjp/trunk/plugins/Stats/Stats.pm	2008-01-18 09:43:52 UTC (rev 434)
+++ slashjp/trunk/plugins/Stats/Stats.pm	2008-01-19 17:11:13 UTC (rev 435)
@@ -144,11 +144,16 @@
 		$self->sqlDo("ALTER TABLE accesslog_temp ADD INDEX referer (referer(4))");
 		# XXX there should be a way to check whether the source accesslog table
 		# already had this index, and if so, to leave it off.
-		$self->sqlDo("ALTER TABLE accesslog_temp ADD INDEX ts (ts)");
-		$self->sqlDo("ALTER TABLE accesslog_temp_errors ADD INDEX ts (ts)");
-		$self->sqlDo("ALTER TABLE accesslog_temp_subscriber ADD INDEX ts (ts)");
-		$self->sqlDo("ALTER TABLE accesslog_temp_other ADD INDEX ts (ts)");
-		$self->sqlDo("ALTER TABLE accesslog_temp_rss ADD INDEX ts (ts)");
+		$self->sqlDo("ALTER TABLE accesslog_temp ADD INDEX ts (ts)")
+			unless ($self->{_dbh}->selectrow_hashref("SHOW FIELDS FROM accesslog_temp LIKE 'ts'")->{Key});
+		$self->sqlDo("ALTER TABLE accesslog_temp_errors ADD INDEX ts (ts)")
+			unless ($self->{_dbh}->selectrow_hashref("SHOW FIELDS FROM accesslog_temp_errors LIKE 'ts'")->{Key});
+		$self->sqlDo("ALTER TABLE accesslog_temp_subscriber ADD INDEX ts (ts)")
+			unless ($self->{_dbh}->selectrow_hashref("SHOW FIELDS FROM accesslog_temp_subscriber LIKE 'ts'")->{Key});
+		$self->sqlDo("ALTER TABLE accesslog_temp_other ADD INDEX ts (ts)")
+			unless ($self->{_dbh}->selectrow_hashref("SHOW FIELDS FROM accesslog_temp_other LIKE 'ts'")->{Key});
+		$self->sqlDo("ALTER TABLE accesslog_temp_rss ADD INDEX ts (ts)")
+			unless ($self->{_dbh}->selectrow_hashref("SHOW FIELDS FROM accesslog_temp_rss LIKE 'ts'")->{Key});
 
 		# Create the other accesslog_temp_* tables and add their indexes.
 		return undef unless $self->_do_insert_select(


Slashdotjp-dev メーリングリストの案内
アーカイブの一覧に戻る