25 Components.utils.import(
"resource://gre/modules/XPCOMUtils.jsm");
26 Components.utils.import(
"resource://app/jsmodules/sbLocalDatabaseMigrationUtils.jsm");
28 const Cc = Components.classes;
29 const Ci = Components.interfaces;
30 const Cr = Components.results;
36 dump(
"----++++----++++sbLibraryMigration " +
39 "\n----++++----++++\n");
44 SBLocalDatabaseMigrationUtils.BaseMigrationHandler.call(
this);
53 __proto__: SBLocalDatabaseMigrationUtils.BaseMigrationHandler.prototype,
56 classID: Components.ID(
"{6C8BA317-BD30-479d-9D9A-8EE44D1F36F7}"),
57 contractID: SBLocalDatabaseMigrationUtils.baseHandlerContractID +
63 migrate:
function sbLibraryMigration_migrate(aLibrary) {
65 this._databaseGUID = aLibrary.databaseGuid;
66 this._databaseLocation = aLibrary.databaseLocation;
69 var dbQuery =
Cc[
"@songbirdnest.com/Songbird/DatabaseQuery;1"]
70 .createInstance(
Ci.sbIDatabaseQuery);
71 dbQuery.databaseLocation = aLibrary.databaseLocation;
72 dbQuery.setDatabaseGUID(aLibrary.databaseGuid);
74 SELECT guid FROM media_items
75 WHERE media_list_type_id =
"2" AND is_list =
"1";
77 dbQuery.setAsyncQuery(
false);
78 if (dbQuery.execute() != 0) {
79 throw "Failed to get the smart playlists";
84 var result = dbQuery.getResultObject();
85 var length = result.getRowCount();
88 var query = this.createMigrationQuery(aLibrary);
89 query.addQuery(
"commit");
91 query.setAsyncQuery(
false);
94 query.execute(retval);
99 var smartListQuery =
Cc[
"@songbirdnest.com/Songbird/DatabaseQuery;1"]
100 .createInstance(
Ci.sbIDatabaseQuery);
101 smartListQuery.setAsyncQuery(
false);
102 smartListQuery.setDatabaseGUID(
"songbird");
103 smartListQuery.addQuery(
"CREATE TABLE IF NOT EXISTS smartplupd_dirty_lists " +
104 "(listguid TEXT UNIQUE NOT NULL)");
106 var prepStatement = smartListQuery.prepareQuery(
107 "INSERT OR REPLACE INTO smartplupd_dirty_lists VALUES (?)");
109 for (var
i = 0;
i < length; ++
i) {
110 guid = result.getRowCell(
i, 0);
111 smartListQuery.addPreparedStatement(prepStatement);
112 smartListQuery.bindStringParameter(0, guid);
115 if (smartListQuery.execute() != 0) {
116 throw "Failed to insert the guid to the dirty db";
119 query.execute(retval);
122 LOG(
"Exception occured: " + e);
132 return XPCOMUtils.generateModule([
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
function sbLibraryMigration()
function NSGetModule(compMgr, fileSpec)
sbDeviceFirmwareAutoCheckForUpdate prototype classID
_getSelectedPageStyle s i