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(
"----++++----++++\nsbLocalDatabaseMigrate070RC2to070 ---> " +
39 "\n----++++----++++\n");
44 SBLocalDatabaseMigrationUtils.BaseMigrationHandler.call(
this);
55 __proto__: SBLocalDatabaseMigrationUtils.BaseMigrationHandler.prototype,
58 classID: Components.ID(
"{116C3A20-DD68-45E9-81FD-EBEEBFD21BF6}"),
59 contractID: SBLocalDatabaseMigrationUtils.baseHandlerContractID +
"0.7.0 RC2 to 0.7.0",
61 _databaseLocation:
null,
66 migrate:
function sbLDBM070RC1to070_migrate(aLibrary) {
67 this._databaseGUID = aLibrary.databaseGuid;
68 this._databaseLocation = aLibrary.databaseLocation;
70 this._getMediaItems();
72 var query = this._createQuery();
73 query.addQuery(
"begin");
75 for(let
i = 0;
i < this._mediaItems.length; ++
i) {
76 let
str =
"update media_items set is_list = ? where media_item_id = ?";
79 query.bindInt32Parameter(0, this._mediaItems[
i].isList);
80 query.bindInt32Parameter(1, this._mediaItems[
i].itemId);
84 query.addQuery(
"update library_metadata set value = '8' where name = 'version'");
87 query.addQuery(
"commit");
90 query.setAsyncQuery(
true);
91 query.execute(retval);
93 var sip =
Cc[
"@mozilla.org/supports-interface-pointer;1"]
94 .createInstance(
Ci.nsISupportsInterfacePointer);
97 this._titleText =
"Library Migration Helper";
98 this._statusText =
"Migrating 0.7.0 RC2 database to 0.7.0 database...";
99 this.migrationQuery = query;
101 this.startNotificationTimer();
102 SBJobUtils.showProgressDialog(sip.data,
null, 0);
103 this.stopNotificationTimer();
106 _createQuery:
function sbLDBM070RC1to070_createQuery() {
107 var query =
Cc[
"@songbirdnest.com/Songbird/DatabaseQuery;1"]
108 .createInstance(
Ci.sbIDatabaseQuery);
109 query.databaseLocation = this._databaseLocation;
110 query.setDatabaseGUID(this._databaseGUID);
115 _getMediaItems:
function sbLDBM070RC1to070_getMediaItems() {
116 this._mediaItems = [];
118 let sql =
"select media_item_id, media_list_type_id from media_items where media_list_type_id is not null";
120 var query = this._createQuery();
124 query.execute(retval);
126 var resultSet = query.getResultObject();
128 var rowCount = resultSet.getRowCount();
129 for(let currentRow = 0; currentRow < rowCount; ++currentRow) {
130 let _mediaItemId = resultSet.getRowCell(currentRow, 0);
131 let _listType = resultSet.getRowCell(currentRow, 1);
132 let _isList = Number(parseInt(_listType) > 0);
134 var
entry = {itemId: _mediaItemId, isList: _isList};
135 this._mediaItems.push(entry);
146 return XPCOMUtils.generateModule([
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
function sbLocalDatabaseMigrate070RC1to070()
sbDeviceFirmwareAutoCheckForUpdate prototype classID
_getSelectedPageStyle s i