Skip to content

Commit

Permalink
Fix defect in delete_recording from previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
djp952 committed Aug 30, 2019
1 parent fa9cc13 commit 7fee68f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,14 @@ void delete_recording(sqlite3* instance, char const* recordingid, bool rerecord)
{
if((instance == nullptr) || (recordingid == nullptr)) return;

// Delete the specified recording from the storage device and the database
execute_non_query(instance, "with httprequest(response) as (select http_post(?1 || '&cmd=delete&rerecord=' || ?2, null)) "
"replace into recording select deviceid, discovered, "
// Delete the specified recording from the storage device
execute_non_query(instance, "select http_post(json_extract(entry.value, '$.CmdURL') || '&cmd=delete&rerecord=' || ?2, null) from recording, json_each(recording.data) as entry "
"where get_recording_id(json_extract(entry.value, '$.CmdURL')) like ?1 limit 1", recordingid, (rerecord) ? 1 : 0);

// Delete the specified recording from the local database
execute_non_query(instance, "replace into recording select deviceid, discovered, "
"(select case when fullkey is null then recording.data else json_remove(recording.data, fullkey) end) as data "
"from httprequest, recording, "
"(select fullkey from recording, json_each(recording.data) as entry where get_recording_id(json_extract(entry.value, '$.CmdURL')) like ?1 limit 1)",
recordingid, (rerecord) ? 1 : 0);
"from recording, (select fullkey from recording, json_each(recording.data) as entry where get_recording_id(json_extract(entry.value, '$.CmdURL')) like ?1 limit 1)", recordingid);
}

//---------------------------------------------------------------------------
Expand Down

0 comments on commit 7fee68f

Please sign in to comment.