[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/amarok-dynamic-collection/src
From:       Andrew Turner <andrewturner512+kdebugs () googlemail ! com>
Date:       2006-07-13 20:59:00
Message-ID: 1152824340.116782.13064.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 562003 by aturner:

Preserve the old version of createStatsTable so that the stats upgrade routine will
always do the same thing for that step, however the stats table is later changed.


 M  +23 -1     collectiondb.cpp  
 M  +4 -0      collectiondb.h  


--- branches/work/amarok-dynamic-collection/src/collectiondb.cpp #562002:562003
@@ -845,7 +845,29 @@
     query( "CREATE INDEX uniqueid_stats ON statistics( uniqueid );" );
 }
 
+//Old version, used in upgrade code. This should never be changed.
+void
+CollectionDB::createStatsTableV8()
+{
+    // create music statistics database - old form, for upgrade code.
+    query( QString( "CREATE TABLE statistics ("
+                    "url " + textColumnType() + " UNIQUE,"
+                    "createdate INTEGER,"
+                    "accessdate INTEGER,"
+                    "percentage FLOAT,"
+                    "rating INTEGER DEFAULT 0,"
+                    "playcounter INTEGER,"
+                    "uniqueid " + textColumnType(8) + " UNIQUE,"
+                    "deleted BOOL DEFAULT " + boolF() + ");" ) );
 
+    query( "CREATE INDEX url_stats ON statistics( url );" );
+    query( "CREATE INDEX percentage_stats ON statistics( percentage );" );
+    query( "CREATE INDEX rating_stats ON statistics( rating );" );
+    query( "CREATE INDEX playcounter_stats ON statistics( playcounter );" );
+    query( "CREATE INDEX uniqueid_stats ON statistics( uniqueid );" );
+}
+
+
 void
 CollectionDB::dropStatsTable()
 {
@@ -4676,7 +4698,7 @@
                         , NULL );
 
                 dropStatsTable();
-                createStatsTable();
+                createStatsTableV8();
 
                 insert( "INSERT INTO statistics (url, createdate, accessdate, \
                percentage, playcounter, rating)"
                         "SELECT url, createdate, accessdate, percentage, \
                playcounter, rating FROM statistics_fix;"
--- branches/work/amarok-dynamic-collection/src/collectiondb.h #562002:562003
@@ -509,6 +509,10 @@
         void createPodcastTables();
         void dropPodcastTables();
 
+        //Archived forms of the above. useful for providing a linear upgrade routine \
that +        //stays the same
+        void createStatsTableV8();
+
         QCString makeWidthKey( uint width );
         QString artistValue( uint id );
         QString albumValue( uint id );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic