{"action":"closed","number":1515,"pull_request":{"url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/pulls/1515","id":210783492,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwNzgzNDky","html_url":"https://github.com/sqlitebrowser/sqlitebrowser/pull/1515","diff_url":"https://github.com/sqlitebrowser/sqlitebrowser/pull/1515.diff","patch_url":"https://github.com/sqlitebrowser/sqlitebrowser/pull/1515.patch","issue_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/issues/1515","number":1515,"state":"closed","locked":false,"title":"Issue #1511: failed deletion in the DB still deletes the rows from model","user":{"login":"mgrojo","id":13812910,"node_id":"MDQ6VXNlcjEzODEyOTEw","avatar_url":"https://avatars2.githubusercontent.com/u/13812910?v=4","gravatar_id":"","url":"https://api.github.com/users/mgrojo","html_url":"https://github.com/mgrojo","followers_url":"https://api.github.com/users/mgrojo/followers","following_url":"https://api.github.com/users/mgrojo/following{/other_user}","gists_url":"https://api.github.com/users/mgrojo/gists{/gist_id}","starred_url":"https://api.github.com/users/mgrojo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgrojo/subscriptions","organizations_url":"https://api.github.com/users/mgrojo/orgs","repos_url":"https://api.github.com/users/mgrojo/repos","events_url":"https://api.github.com/users/mgrojo/events{/privacy}","received_events_url":"https://api.github.com/users/mgrojo/received_events","type":"User","site_admin":false},"body":"If the deletion of a record is rejected by the SQLite3, for example, due to\r\nthe presence of Foreign Key constraints, the corresponding rows must not\r\nbe deleted from the model.\r\n\r\nThis change is simple and it's apparently working, but I open this pull request because I'm not sure of the\r\nimplications of removing the database records outside of the beginRemoveRows(...)..endRemoveRows() calls. Apparently there's no way to abort the deletion inside this block.\r\n\r\nAnother effective, but hard and inefficient, solution is to refresh the table automatically if the deletion\r\nfails:\r\n```diff\r\ndiff --git a/src/MainWindow.cpp b/src/MainWindow.cpp\r\nindex 0b23d6f..7d0f32e 100644\r\n--- a/src/MainWindow.cpp\r\n+++ b/src/MainWindow.cpp\r\n@@ -741,6 +741,7 @@ void MainWindow::deleteRecord()\r\n             if(!m_browseTableModel->removeRows(first_selected_row, selected_rows_count))\r\n             {\r\n                 QMessageBox::warning(this, QApplication::applicationName(), tr(\"Error deleting record:\\n%1\").arg(db.lastError()));\r\n+                populateTable();\r\n                 break;\r\n             }\r\n         }\r\n```","created_at":"2018-08-24T16:04:03Z","updated_at":"2018-08-27T19:47:10Z","closed_at":"2018-08-27T19:47:10Z","merged_at":"2018-08-27T19:47:10Z","merge_commit_sha":"14106de34c3a67e2eb0e7c14c84d9d49dc99661d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/pulls/1515/commits","review_comments_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/pulls/1515/comments","review_comment_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/issues/1515/comments","statuses_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/statuses/f8830d27c2f1c31e0b90e96ead253661aede055c","head":{"label":"sqlitebrowser:failed_deletion","ref":"failed_deletion","sha":"f8830d27c2f1c31e0b90e96ead253661aede055c","user":{"login":"sqlitebrowser","id":7454271,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc0NTQyNzE=","avatar_url":"https://avatars2.githubusercontent.com/u/7454271?v=4","gravatar_id":"","url":"https://api.github.com/users/sqlitebrowser","html_url":"https://github.com/sqlitebrowser","followers_url":"https://api.github.com/users/sqlitebrowser/followers","following_url":"https://api.github.com/users/sqlitebrowser/following{/other_user}","gists_url":"https://api.github.com/users/sqlitebrowser/gists{/gist_id}","starred_url":"https://api.github.com/users/sqlitebrowser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sqlitebrowser/subscriptions","organizations_url":"https://api.github.com/users/sqlitebrowser/orgs","repos_url":"https://api.github.com/users/sqlitebrowser/repos","events_url":"https://api.github.com/users/sqlitebrowser/events{/privacy}","received_events_url":"https://api.github.com/users/sqlitebrowser/received_events","type":"Organization","site_admin":false},"repo":{"id":19416551,"node_id":"MDEwOlJlcG9zaXRvcnkxOTQxNjU1MQ==","name":"sqlitebrowser","full_name":"sqlitebrowser/sqlitebrowser","owner":{"login":"sqlitebrowser","id":7454271,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc0NTQyNzE=","avatar_url":"https://avatars2.githubusercontent.com/u/7454271?v=4","gravatar_id":"","url":"https://api.github.com/users/sqlitebrowser","html_url":"https://github.com/sqlitebrowser","followers_url":"https://api.github.com/users/sqlitebrowser/followers","following_url":"https://api.github.com/users/sqlitebrowser/following{/other_user}","gists_url":"https://api.github.com/users/sqlitebrowser/gists{/gist_id}","starred_url":"https://api.github.com/users/sqlitebrowser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sqlitebrowser/subscriptions","organizations_url":"https://api.github.com/users/sqlitebrowser/orgs","repos_url":"https://api.github.com/users/sqlitebrowser/repos","events_url":"https://api.github.com/users/sqlitebrowser/events{/privacy}","received_events_url":"https://api.github.com/users/sqlitebrowser/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sqlitebrowser/sqlitebrowser","description":"Official home of the DB Browser for SQLite (DB4S) project. Previously known as \"SQLite Database Browser\" and \"Database Browser for SQLite\". Website at: ","fork":false,"url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser","forks_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/forks","keys_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/teams","hooks_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/hooks","issue_events_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/issues/events{/number}","events_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/events","assignees_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/assignees{/user}","branches_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/branches{/branch}","tags_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/tags","blobs_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/git/refs{/sha}","trees_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/statuses/{sha}","languages_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/languages","stargazers_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/stargazers","contributors_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/contributors","subscribers_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/subscribers","subscription_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/subscription","commits_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/commits{/sha}","git_commits_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/git/commits{/sha}","comments_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/comments{/number}","issue_comment_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/issues/comments{/number}","contents_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/contents/{+path}","compare_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/merges","archive_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/downloads","issues_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/issues{/number}","pulls_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/pulls{/number}","milestones_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/milestones{/number}","notifications_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/labels{/name}","releases_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/releases{/id}","deployments_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/deployments","created_at":"2014-05-04T01:54:44Z","updated_at":"2018-08-27T19:35:14Z","pushed_at":"2018-08-27T19:47:10Z","git_url":"git://github.com/sqlitebrowser/sqlitebrowser.git","ssh_url":"git@github.com:sqlitebrowser/sqlitebrowser.git","clone_url":"https://github.com/sqlitebrowser/sqlitebrowser.git","svn_url":"https://github.com/sqlitebrowser/sqlitebrowser","homepage":"https://sqlitebrowser.org","size":13672,"stargazers_count":9357,"watchers_count":9357,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1114,"mirror_url":null,"archived":false,"open_issues_count":299,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1114,"open_issues":299,"watchers":9357,"default_branch":"master"}},"base":{"label":"sqlitebrowser:master","ref":"master","sha":"d5a049062d4795ba91b860ac33561450ba1dce8c","user":{"login":"sqlitebrowser","id":7454271,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc0NTQyNzE=","avatar_url":"https://avatars2.githubusercontent.com/u/7454271?v=4","gravatar_id":"","url":"https://api.github.com/users/sqlitebrowser","html_url":"https://github.com/sqlitebrowser","followers_url":"https://api.github.com/users/sqlitebrowser/followers","following_url":"https://api.github.com/users/sqlitebrowser/following{/other_user}","gists_url":"https://api.github.com/users/sqlitebrowser/gists{/gist_id}","starred_url":"https://api.github.com/users/sqlitebrowser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sqlitebrowser/subscriptions","organizations_url":"https://api.github.com/users/sqlitebrowser/orgs","repos_url":"https://api.github.com/users/sqlitebrowser/repos","events_url":"https://api.github.com/users/sqlitebrowser/events{/privacy}","received_events_url":"https://api.github.com/users/sqlitebrowser/received_events","type":"Organization","site_admin":false},"repo":{"id":19416551,"node_id":"MDEwOlJlcG9zaXRvcnkxOTQxNjU1MQ==","name":"sqlitebrowser","full_name":"sqlitebrowser/sqlitebrowser","owner":{"login":"sqlitebrowser","id":7454271,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc0NTQyNzE=","avatar_url":"https://avatars2.githubusercontent.com/u/7454271?v=4","gravatar_id":"","url":"https://api.github.com/users/sqlitebrowser","html_url":"https://github.com/sqlitebrowser","followers_url":"https://api.github.com/users/sqlitebrowser/followers","following_url":"https://api.github.com/users/sqlitebrowser/following{/other_user}","gists_url":"https://api.github.com/users/sqlitebrowser/gists{/gist_id}","starred_url":"https://api.github.com/users/sqlitebrowser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sqlitebrowser/subscriptions","organizations_url":"https://api.github.com/users/sqlitebrowser/orgs","repos_url":"https://api.github.com/users/sqlitebrowser/repos","events_url":"https://api.github.com/users/sqlitebrowser/events{/privacy}","received_events_url":"https://api.github.com/users/sqlitebrowser/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sqlitebrowser/sqlitebrowser","description":"Official home of the DB Browser for SQLite (DB4S) project. Previously known as \"SQLite Database Browser\" and \"Database Browser for SQLite\". Website at: ","fork":false,"url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser","forks_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/forks","keys_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/teams","hooks_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/hooks","issue_events_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/issues/events{/number}","events_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/events","assignees_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/assignees{/user}","branches_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/branches{/branch}","tags_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/tags","blobs_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/git/refs{/sha}","trees_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/statuses/{sha}","languages_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/languages","stargazers_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/stargazers","contributors_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/contributors","subscribers_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/subscribers","subscription_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/subscription","commits_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/commits{/sha}","git_commits_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/git/commits{/sha}","comments_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/comments{/number}","issue_comment_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/issues/comments{/number}","contents_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/contents/{+path}","compare_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/merges","archive_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/downloads","issues_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/issues{/number}","pulls_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/pulls{/number}","milestones_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/milestones{/number}","notifications_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/labels{/name}","releases_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/releases{/id}","deployments_url":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/deployments","created_at":"2014-05-04T01:54:44Z","updated_at":"2018-08-27T19:35:14Z","pushed_at":"2018-08-27T19:47:10Z","git_url":"git://github.com/sqlitebrowser/sqlitebrowser.git","ssh_url":"git@github.com:sqlitebrowser/sqlitebrowser.git","clone_url":"https://github.com/sqlitebrowser/sqlitebrowser.git","svn_url":"https://github.com/sqlitebrowser/sqlitebrowser","homepage":"https://sqlitebrowser.org","size":13672,"stargazers_count":9357,"watchers_count":9357,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1114,"mirror_url":null,"archived":false,"open_issues_count":299,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1114,"open_issues":299,"watchers":9357,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/pulls/1515"},"html":{"href":"https://github.com/sqlitebrowser/sqlitebrowser/pull/1515"},"issue":{"href":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/issues/1515"},"comments":{"href":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/issues/1515/comments"},"review_comments":{"href":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/pulls/1515/comments"},"review_comment":{"href":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/pulls/1515/commits"},"statuses":{"href":"https://api.github.com/repos/sqlitebrowser/sqlitebrowser/statuses/f8830d27c2f1c31e0b90e96ead253661aede055c"}},"author_association":"CONTRIBUTOR","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"MKleusberg","id":3153504,"node_id":"MDQ6VXNlcjMxNTM1MDQ=","avatar_url":"https://avatars3.githubusercontent.com/u/3153504?v=4","gravatar_id":"","url":"https://api.github.com/users/MKleusberg","html_url":"https://github.com/MKleusberg","followers_url":"https://api.github.com/users/MKleusberg/followers","following_url":"https://api.github.com/users/MKleusberg/following{/other_user}","gists_url":"https://api.github.com/users/MKleusberg/gists{/gist_id}","starred_url":"https://api.github.com/users/MKleusberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MKleusberg/subscriptions","organizations_url":"https://api.github.com/users/MKleusberg/orgs","repos_url":"https://api.github.com/users/MKleusberg/repos","events_url":"https://api.github.com/users/MKleusberg/events{/privacy}","received_events_url":"https://api.github.com/users/MKleusberg/received_events","type":"User","site_admin":false},"comments":1,"review_comments":0,"maintainer_can_modify":false,"commits":1,"additions":11,"deletions":5,"changed_files":1}}
{"actor":{"display_login":"MKleusberg"}}