Merge lp:~ahayzen/music-app/fix-1411113-db-locking into lp:music-app/remix

Proposed by Andrew Hayzen
Status: Merged
Approved by: Victor Thompson
Approved revision: 784
Merged at revision: 784
Proposed branch: lp:~ahayzen/music-app/fix-1411113-db-locking
Merge into: lp:music-app/remix
Diff against target: 32 lines (+6/-7)
1 file modified
meta-database.js (+6/-7)
To merge this branch: bzr merge lp:~ahayzen/music-app/fix-1411113-db-locking
Reviewer Review Type Date Requested Status
Victor Thompson Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+246638@code.launchpad.net

Commit message

* Clear from the recent table instead of dropping when clearing

Description of the change

* Clear from the recent table instead of dropping when clearing

Instead of dropping and rebuilding the table each time, delete all the records. Also change the startup process so that there is less duplication of calls (used to call CREATE TABLE IF NOT EXISTS twice for an upgrade), now it is always once.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Victor Thompson (vthompson) wrote :

Thanks, this fixes the issue! Nice work!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'meta-database.js'
2--- meta-database.js 2015-01-11 18:44:18 +0000
3+++ meta-database.js 2015-01-15 20:17:55 +0000
4@@ -207,14 +207,14 @@
5 var db = getDatabase();
6 db.transaction(
7 function(tx) {
8- // Data is either the playlist name or album name
9- tx.executeSql("CREATE TABLE IF NOT EXISTS recent(time DATETIME UNIQUE, data TEXT, type TEXT)");
10-
11- // Check of old version of db and then clear if needed
12+ // Check of old version of db (or no db) then clear and rebuild if needed
13 try {
14 tx.executeSql("SELECT data FROM recent");
15 } catch (e) {
16- clearRecentHistory();
17+ tx.executeSql('DROP TABLE IF EXISTS recent');
18+
19+ // Data is either the playlist name or album name
20+ tx.executeSql("CREATE TABLE IF NOT EXISTS recent(time DATETIME UNIQUE, data TEXT, type TEXT)");
21 }
22 });
23 }
24@@ -223,8 +223,7 @@
25 var db = getDatabase();
26 db.transaction(
27 function(tx) {
28- tx.executeSql('DROP TABLE IF EXISTS recent');
29- tx.executeSql("CREATE TABLE IF NOT EXISTS recent(time DATETIME UNIQUE, data TEXT, type TEXT)");
30+ tx.executeSql('DELETE FROM recent');
31 });
32 }
33

Subscribers

People subscribed via source and target branches