{"action":"created","issue":{"url":"https://api.github.com/repos/madorin/fibplus/issues/4","repository_url":"https://api.github.com/repos/madorin/fibplus","labels_url":"https://api.github.com/repos/madorin/fibplus/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/madorin/fibplus/issues/4/comments","events_url":"https://api.github.com/repos/madorin/fibplus/issues/4/events","html_url":"https://github.com/madorin/fibplus/issues/4","id":188481166,"number":4,"title":"TpFIBQuery. закрытие транзакции после первого фетча","user":{"login":"dshumko","id":8360276,"avatar_url":"https://avatars.githubusercontent.com/u/8360276?v=3","gravatar_id":"","url":"https://api.github.com/users/dshumko","html_url":"https://github.com/dshumko","followers_url":"https://api.github.com/users/dshumko/followers","following_url":"https://api.github.com/users/dshumko/following{/other_user}","gists_url":"https://api.github.com/users/dshumko/gists{/gist_id}","starred_url":"https://api.github.com/users/dshumko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dshumko/subscriptions","organizations_url":"https://api.github.com/users/dshumko/orgs","repos_url":"https://api.github.com/users/dshumko/repos","events_url":"https://api.github.com/users/dshumko/events{/privacy}","received_events_url":"https://api.github.com/users/dshumko/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-11-10T11:13:13Z","updated_at":"2016-12-12T11:30:10Z","closed_at":"2016-11-10T16:03:09Z","body":"если у TpFIBQuery задать следующие параметры \r\nGoToFirstRecordOnExecute = True;\r\nqoStartTransaction = true\r\nqoAutoCommit = true\r\nто при выборке `select` происходит закрытие транзакции после первого фетча, что приводит к ошибке выполнения\r\n\r\nсмотрим код в версия [7.6 код](https://github.com/madorin/fibplus/blob/master/FIBQuery.pas#L4684-L4689)\r\n```pascal\r\nif FGoToFirstRecordOnExecute\r\nthen begin\r\n    DoAfterExecute(Assigned(FMDTMainDataOrder), vAfterExecEvent);\r\n    vAfterExecEvent := False;\r\n    Next;\r\nend;\r\n```\r\nв версии 7.5 код был такой\r\n```pascal\r\nif FGoToFirstRecordOnExecute then\r\n    Next;\r\n```\r\nдумаю `DoAfterExecute` лишний в версии 7.6 этот код выполнится [позже](https://github.com/madorin/fibplus/blob/master/FIBQuery.pas#L4742-L4743)"},"comment":{"url":"https://api.github.com/repos/madorin/fibplus/issues/comments/266405718","html_url":"https://github.com/madorin/fibplus/issues/4#issuecomment-266405718","issue_url":"https://api.github.com/repos/madorin/fibplus/issues/4","id":266405718,"user":{"login":"AnryJester","id":24522583,"avatar_url":"https://avatars.githubusercontent.com/u/24522583?v=3","gravatar_id":"","url":"https://api.github.com/users/AnryJester","html_url":"https://github.com/AnryJester","followers_url":"https://api.github.com/users/AnryJester/followers","following_url":"https://api.github.com/users/AnryJester/following{/other_user}","gists_url":"https://api.github.com/users/AnryJester/gists{/gist_id}","starred_url":"https://api.github.com/users/AnryJester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AnryJester/subscriptions","organizations_url":"https://api.github.com/users/AnryJester/orgs","repos_url":"https://api.github.com/users/AnryJester/repos","events_url":"https://api.github.com/users/AnryJester/events{/privacy}","received_events_url":"https://api.github.com/users/AnryJester/received_events","type":"User","site_admin":false},"created_at":"2016-12-12T11:30:10Z","updated_at":"2016-12-12T11:30:10Z","body":"Данный фикс \"сломал\" функционал получения количества записей, который был раньше работал корректно и вполне логично:\r\nВ событии OnAfterExecute проверяется количество записей через свойство RecordCount.\r\nСоответственно перенос кода\r\n```\r\nif FGoToFirstRecordOnExecute and FOpen then\r\n    Next;\r\n```\r\nпосле вызова события DoAfterExecute не логично и \"ломает\" работу компонента.\r\n1. При проверке количества записей в событии DoAfterExecute соответственно получаем 0.\r\n2. Выбор следующей записи вполне логично для SQLSelect, а не для всех типов SQL.\r\n3. DoAfterExecute как следует из названия должен выполнялся самой последней инструкцией, после всех действий.\r\n\r\nЛучше явно управлять транзакциями, чем пытаясь вылечить \"автоматический\" режим \"сломать\" основной функционал.\r\n"}}
{"actor":{"display_login":"AnryJester"}}