sbMigrate08pre1To08pre2.js
Go to the documentation of this file.
1 /*
2 //
3 // BEGIN SONGBIRD GPL
4 //
5 // This file is part of the Songbird web player.
6 //
7 // Copyright(c) 2005-2008 POTI, Inc.
8 // http://songbirdnest.com
9 //
10 // This file may be licensed under the terms of of the
11 // GNU General Public License Version 2 (the "GPL").
12 //
13 // Software distributed under the License is distributed
14 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
15 // express or implied. See the GPL for the specific language
16 // governing rights and limitations.
17 //
18 // You should have received a copy of the GPL along with this
19 // program. If not, go to http://www.gnu.org/licenses/gpl.html
20 // or write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23 // END SONGBIRD GPL
24 //
25 */
26 
27 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
28 Components.utils.import("resource://app/jsmodules/ArrayConverter.jsm");
29 Components.utils.import("resource://app/jsmodules/sbLocalDatabaseMigrationUtils.jsm");
30 Components.utils.import("resource://app/jsmodules/SBJobUtils.jsm");
31 
32 const Cc = Components.classes;
33 const Ci = Components.interfaces;
34 const Cr = Components.results;
35 
36 function LOG(s) {
37  dump("----++++----++++\sbLocalDatabaseMigrate08pre1to08pre2 ---> " +
38  s +
39  "\n----++++----++++\n");
40 }
41 
43 {
44  SBLocalDatabaseMigrationUtils.BaseMigrationHandler.call(this);
45 
46  this.fromVersion = 9;
47  this.toVersion = 10;
48 }
49 
50 //-----------------------------------------------------------------------------
51 // sbLocalDatabaseMigration Implementation
52 //-----------------------------------------------------------------------------
53 
55  __proto__: SBLocalDatabaseMigrationUtils.BaseMigrationHandler.prototype,
56 
57  classDescription: 'Songbird Migration Handler for 0.8pre1 to 0.8pre2, removing unused indices',
58  classID: Components.ID("{3a67a390-8b2e-11dd-ad8b-0800200c9a66}"),
59  contractID: SBLocalDatabaseMigrationUtils.baseHandlerContractID + "0.8.0 pre1 to 0.8.0 pre2",
60 
61  _databaseLocation: null,
62  _databaseGUID: null,
63 
64  _mediaItems: null,
65 
66  migrate: function sbLDBM08pre1to08pre2_migrate(aLibrary) {
67  this._databaseGUID = aLibrary.databaseGuid;
68  this._databaseLocation = aLibrary.databaseLocation;
69 
70  var query = this._createQuery();
71 
72  // Drop unused indices
73  query.addQuery("begin");
74  query.addQuery("drop index idx_media_items_content_hash");
75  query.addQuery("drop index idx_resource_properties_property_id_obj");
76  query.addQuery("drop index idx_resource_properties_obj_sortable");
77  query.addQuery("drop index idx_resource_properties_media_item_id_property_id_obj_sortable");
78 
79  // Update the schema version to the destination version.
80  query.addQuery("update library_metadata set value = '10' where name = 'version'");
81  query.addQuery("commit");
82 
83  // Try to reduce db size
84  query.addQuery("VACUUM");
85 
86  var retval;
87  query.setAsyncQuery(true);
88  query.execute(retval);
89 
90  var sip = Cc["@mozilla.org/supports-interface-pointer;1"]
91  .createInstance(Ci.nsISupportsInterfacePointer);
92  sip.data = this;
93 
94  this._titleText = "Library Migration Helper";
95  this._statusText = "Compacting library database...";
96  this.migrationQuery = query;
97 
98  this.startNotificationTimer();
99  SBJobUtils.showProgressDialog(sip.data, null, 0);
100  this.stopNotificationTimer();
101  },
102 
103  _createQuery: function sbLDBM08pre1to08pre2_createQuery() {
104  var query = Cc["@songbirdnest.com/Songbird/DatabaseQuery;1"]
105  .createInstance(Ci.sbIDatabaseQuery);
106  query.databaseLocation = this._databaseLocation;
107  query.setDatabaseGUID(this._databaseGUID);
108 
109  return query;
110  }
111 }
112 
113 
114 //
115 // Module
116 //
117 
118 function NSGetModule(compMgr, fileSpec) {
119  return XPCOMUtils.generateModule([
121  ]);
122 }
function LOG(s)
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
return null
Definition: FeedWriter.js:1143
function sbLocalDatabaseMigrate08pre1to08pre2()
sbDeviceFirmwareAutoCheckForUpdate prototype classID