d1vanov/libquentier

Ensure updates of notebooks and tags which clear guids from these data items are processed properly

Opened this issue · 0 comments

Within d1vanov/quentier#192 the necessity to update notes in a very special way was encountered: guids needed to have been cleared from notes which had non-empty guids previously. Turned out the "usual" INSERT OR REPLACE SQL query run within the local storage for data updates leads to the violation of foreign key - the "REPLACE" part of the query tries to delete the row and insert it again, the deletion fails because the row's guid is used as a foreign key in some other tables. The solution for notes was to explicitly update guid to NULL before running the INSERT OR REPLACE query. Need to do the same for updates of notebooks and tags as they are the subject for similar foreign key constraint issues.