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");
32 const Cc = Components.classes;
33 const Ci = Components.interfaces;
34 const Cr = Components.results;
37 dump(
"----++++----++++sbLibraryMigration " +
40 "\n----++++----++++\n");
45 SBLocalDatabaseMigrationUtils.BaseMigrationHandler.call(
this);
47 this.fromVersion = 14;
49 this.versionString = this.fromVersion +
" to " +
58 __proto__: SBLocalDatabaseMigrationUtils.BaseMigrationHandler.prototype,
60 classID: Components.ID(
"{3e473356-a84a-4243-a597-6919cb1a26ff}"),
61 contractID: SBLocalDatabaseMigrationUtils.baseHandlerContractID +
' 14 to 15',
63 _databaseLocation:
null,
66 migrate:
function sbLibraryMigration_migrate(aLibrary) {
69 this._databaseGUID = aLibrary.databaseGuid;
70 this._databaseLocation = aLibrary.databaseLocation;
72 var query = this._createQuery();
78 query.addQuery(
"create table resource_properties_2 (" +
79 "media_item_id integer not null," +
80 "property_id integer not null," +
81 "obj text not null," +
82 "obj_searchable text," +
83 "obj_sortable text collate library_collate," +
84 "obj_secondary_sortable text collate library_collate," +
85 "primary key (media_item_id, property_id)" +
92 query.addQuery(
"insert into resource_properties_2 (media_item_id, property_id, obj) select media_item_id, property_id, obj from resource_properties;");
95 query.addQuery(
"drop table resource_properties;");
98 query.addQuery(
"alter table resource_properties_2 rename to resource_properties;");
101 query.addQuery(
"create index idx_resource_properties_property_id_obj_sortable_obj_secondary_sortable_media_item_id on resource_properties " +
102 "(property_id, obj_sortable, obj_secondary_sortable, media_item_id);");
105 query.addQuery(
"update library_metadata set value = '"
106 + this.toVersion +
"' where name = 'version'");
107 query.addQuery(
"commit");
110 query.addQuery(
"VACUUM");
113 query.setAsyncQuery(
true);
114 query.execute(retval);
116 this._titleText =
"Library Migration Helper";
117 this._statusText =
"Improving sorting data...";
118 this.migrationQuery = query;
120 var sip =
Cc[
"@mozilla.org/supports-interface-pointer;1"]
121 .createInstance(
Ci.nsISupportsInterfacePointer);
124 this.startNotificationTimer();
125 SBJobUtils.showProgressDialog(sip.data,
null, 0);
126 this.stopNotificationTimer();
132 var
prefs =
Cc[
"@mozilla.org/preferences-service;1"]
133 .getService(
Ci.nsIPrefBranch);
134 prefs.setBoolPref(
"songbird.propertycache." +
135 this._databaseGUID +
".invalidSortData",
true);
136 prefs.QueryInterface(
Ci.nsIPrefService).savePrefFile(
null);
139 dump(
"Exception occured: " + e);
144 _createQuery:
function sbLibraryMigration_createQuery() {
145 var query =
Cc[
"@songbirdnest.com/Songbird/DatabaseQuery;1"]
146 .createInstance(
Ci.sbIDatabaseQuery);
147 query.databaseLocation = this._databaseLocation;
148 query.setDatabaseGUID(this._databaseGUID);
159 return XPCOMUtils.generateModule([
function sbLibraryMigration()
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
function NSGetModule(compMgr, fileSpec)
sbDeviceFirmwareAutoCheckForUpdate prototype classID