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(
"{6f74cb1d-49b5-4475-99ca-63ebb3696a40}"),
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(
104 "CREATE TABLE IF NOT EXISTS smartplupd_update_video_lists " +
105 "(listguid TEXT UNIQUE NOT NULL)");
107 var prepStatement = smartListQuery.prepareQuery(
108 "INSERT OR REPLACE INTO smartplupd_update_video_lists VALUES (?)");
110 for (var
i = 0;
i < length; ++
i) {
111 guid = result.getRowCell(
i, 0);
112 smartListQuery.addPreparedStatement(prepStatement);
113 smartListQuery.bindStringParameter(0, guid);
116 if (smartListQuery.execute() != 0) {
117 throw "Failed to insert the guid to the dirty db";
120 query.execute(retval);
123 LOG(
"Exception occured: " + e);
133 return XPCOMUtils.generateModule([
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
function sbLibraryMigration()
sbDeviceFirmwareAutoCheckForUpdate prototype classID
function NSGetModule(compMgr, fileSpec)
_getSelectedPageStyle s i