{"action":"closed","issue":{"url":"https://api.github.com/repos/fpdo/fluentpdo/issues/139","repository_url":"https://api.github.com/repos/fpdo/fluentpdo","labels_url":"https://api.github.com/repos/fpdo/fluentpdo/issues/139/labels{/name}","comments_url":"https://api.github.com/repos/fpdo/fluentpdo/issues/139/comments","events_url":"https://api.github.com/repos/fpdo/fluentpdo/issues/139/events","html_url":"https://github.com/fpdo/fluentpdo/issues/139","id":101796398,"number":139,"title":"Error management","user":{"login":"Zyles","id":1741593,"avatar_url":"https://avatars.githubusercontent.com/u/1741593?v=3","gravatar_id":"","url":"https://api.github.com/users/Zyles","html_url":"https://github.com/Zyles","followers_url":"https://api.github.com/users/Zyles/followers","following_url":"https://api.github.com/users/Zyles/following{/other_user}","gists_url":"https://api.github.com/users/Zyles/gists{/gist_id}","starred_url":"https://api.github.com/users/Zyles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zyles/subscriptions","organizations_url":"https://api.github.com/users/Zyles/orgs","repos_url":"https://api.github.com/users/Zyles/repos","events_url":"https://api.github.com/users/Zyles/events{/privacy}","received_events_url":"https://api.github.com/users/Zyles/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-19T03:01:18Z","updated_at":"2016-03-10T13:03:19Z","closed_at":"2016-03-10T13:03:19Z","body":"Can you update docs with examples on error management?\r\n\r\nHow do I get affected rows for example?\r\n\r\nThe equivalent to this:\r\n\r\n```\r\n$sql = 'DELETE FROM items WHERE id = ' . $id;\r\n$stmt = $db->prepare($sql);\r\n$stmt->execute();\r\n$rowCount = $stmt->rowCount();\r\nif ($rowCount == 0) {\r\n\t\t\t\tthrow new \\Exception('No item with id \\'' . $id . '\\' found.', Codes::HTTP_NOT_FOUND);\r\n\t\t\t}\r\n```\r\n\r\nWhen I run:\r\n\r\n```\r\n$query = $fpdo->delete('items')->where('id', $id)->execute();\r\n```\r\n\r\nThere is never an error, even if the ID does not exist. How do I check for this? I want to know how many items were deleted.\r\n\r\nSame goes for UPDATE and INSERTS.\r\n\r\nThanks.\r\n\r\n"}}