~ahayzen/music-app/remix-perf-001

« back to all changes in this revision

Viewing changes to meta-database.js

  • Committer: Victor Thompson
  • Date: 2014-10-18 03:49:51 UTC
  • mto: This revision was merged to the branch mainline in revision 676.
  • Revision ID: victor.thompson@gmail.com-20141018034951-210ve6vm6piyxz90
Fix playlist deletion and renaming in recent table

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
    return res;
104
104
}
105
105
 
 
106
function recentContainsPlaylist(key) {
 
107
    var db = getDatabase();
 
108
    var rs;
 
109
    db.transaction( function(tx) {
 
110
        rs = tx.executeSql("SELECT count(*) as value FROM recent WHERE type=? AND key=?",
 
111
                               ["playlist", key]);
 
112
    }
 
113
    );
 
114
    return rs.rows.item(0).value > 0;
 
115
}
 
116
 
 
117
function recentRemovePlaylist(key) {
 
118
    var res = false
 
119
    var db = getDatabase();
 
120
    db.transaction( function(tx) {
 
121
        res = tx.executeSql("DELETE FROM recent WHERE type=? AND key=?",
 
122
                            ["playlist", key]).rowsAffected > 0;
 
123
 
 
124
    })
 
125
    return res
 
126
}
 
127
 
 
128
function recentRenamePlaylist(oldKey, newKey) {
 
129
    var db = getDatabase();
 
130
    db.transaction( function(tx) {
 
131
        tx.executeSql("UPDATE recent SET title=?,key=? WHERE type=? AND key=?",
 
132
                            [newKey, newKey, "playlist", oldKey]);
 
133
 
 
134
    })
 
135
}
 
136
 
106
137
function isRecentEmpty() {
107
138
    var db = getDatabase();
108
139
    var res = 0;