sbMigrate18to19pre0.indexSort.js
Go to the documentation of this file.
1 /*
2  *=BEGIN SONGBIRD GPL
3  *
4  * This file is part of the Songbird web player.
5  *
6  * Copyright(c) 2005-2010 POTI, Inc.
7  * http://www.songbirdnest.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the ``GPL'').
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  *=END SONGBIRD GPL
23  */
24 
25 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
26 Components.utils.import("resource://app/jsmodules/sbLocalDatabaseMigrationUtils.jsm");
27 Components.utils.import("resource://app/jsmodules/SBJobUtils.jsm");
28 
29 const Cc = Components.classes;
30 const Ci = Components.interfaces;
31 const Cr = Components.results;
32 
33 const FROM_VERSION = 27;
34 const TO_VERSION = 28;
35 
36 function LOG(s) {
37  dump("----++++----++++sbLibraryMigration " +
38  FROM_VERSION + " to " + TO_VERSION + ": " +
39  s +
40  "\n----++++----++++\n");
41 }
42 
44 {
45  SBLocalDatabaseMigrationUtils.BaseMigrationHandler.call(this);
46  this._errors = [];
47 }
48 
49 //-----------------------------------------------------------------------------
50 // sbLocalDatabaseMigration Implementation
51 //-----------------------------------------------------------------------------
52 
53 sbLibraryMigration.prototype = {
54  __proto__: SBLocalDatabaseMigrationUtils.BaseMigrationHandler.prototype,
55  classDescription: 'Songbird Migration Handler, version ' +
56  FROM_VERSION + ' to ' + TO_VERSION,
57  classID: Components.ID("{7f77e6fa-b3b0-40d5-88f8-203482abfbd9}"),
58  contractID: SBLocalDatabaseMigrationUtils.baseHandlerContractID +
59  FROM_VERSION + 'to' + TO_VERSION,
60 
61  fromVersion: FROM_VERSION,
62  toVersion: TO_VERSION,
63 
64  migrate: function sbLibraryMigration_migrate(aLibrary) {
65  try {
66  this._databaseGUID = aLibrary.databaseGuid;
67  this._databaseLocation = aLibrary.databaseLocation;
68 
69  // Run a query that will mark the library as migrated
70  var query = this.createMigrationQuery(aLibrary);
71  query.addQuery("CREATE INDEX idx_resource_properties_property_id_obj_sortable_obj_secondary_sortable_media_item_id_asc on resource_properties (property_id, obj_sortable ASC, obj_secondary_sortable ASC, media_item_id ASC)");
72  query.addQuery("CREATE INDEX idx_resource_properties_property_id_obj_sortable_obj_secondary_sortable_media_item_id_desc on resource_properties (property_id, obj_sortable DESC, obj_secondary_sortable DESC, media_item_id DESC)");
73  query.addQuery("REINDEX");
74  query.addQuery("ANALYZE");
75  query.addQuery("COMMIT");
76 
77  this.migrationQuery = query;
78 
79  var sip = Cc["@mozilla.org/supports-interface-pointer;1"]
80  .createInstance(Ci.nsISupportsInterfacePointer);
81  sip.data = this;
82 
83  this._titleText = "Library Migration Helper";
84  this._statusText = "Migrating 1.8 database to 1.9 database...";
85 
86  query.setAsyncQuery(true);
87  query.execute();
88 
89  this.startNotificationTimer();
90  SBJobUtils.showProgressDialog(sip.data, null, 0);
91  this.stopNotificationTimer();
92  }
93  catch (e) {
94  dump("Exception occured: " + e);
95  throw e;
96  }
97  }
98 };
99 
100 //-----------------------------------------------------------------------------
101 // Module
102 //-----------------------------------------------------------------------------
103 function NSGetModule(compMgr, fileSpec) {
104  return XPCOMUtils.generateModule([
106  ]);
107 }
108 
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
function sbLibraryMigration()
function NSGetModule(compMgr, fileSpec)
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
function LOG(s)
return null
Definition: FeedWriter.js:1143
sbDeviceFirmwareAutoCheckForUpdate prototype classID