{"action":"created","issue":{"url":"https://api.github.com/repos/nhibernate/nhibernate-core/issues/505","repository_url":"https://api.github.com/repos/nhibernate/nhibernate-core","labels_url":"https://api.github.com/repos/nhibernate/nhibernate-core/issues/505/labels{/name}","comments_url":"https://api.github.com/repos/nhibernate/nhibernate-core/issues/505/comments","events_url":"https://api.github.com/repos/nhibernate/nhibernate-core/issues/505/events","html_url":"https://github.com/nhibernate/nhibernate-core/pull/505","id":172812144,"number":505,"title":"NH-3901, NH-3846 - Correct IndexOfGenerator index offsets","user":{"login":"PleasantD","id":4439838,"avatar_url":"https://avatars.githubusercontent.com/u/4439838?v=3","gravatar_id":"","url":"https://api.github.com/users/PleasantD","html_url":"https://github.com/PleasantD","followers_url":"https://api.github.com/users/PleasantD/followers","following_url":"https://api.github.com/users/PleasantD/following{/other_user}","gists_url":"https://api.github.com/users/PleasantD/gists{/gist_id}","starred_url":"https://api.github.com/users/PleasantD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PleasantD/subscriptions","organizations_url":"https://api.github.com/users/PleasantD/orgs","repos_url":"https://api.github.com/users/PleasantD/repos","events_url":"https://api.github.com/users/PleasantD/events{/privacy}","received_events_url":"https://api.github.com/users/PleasantD/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2016-08-23T21:30:53Z","updated_at":"2016-11-04T23:54:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nhibernate/nhibernate-core/pulls/505","html_url":"https://github.com/nhibernate/nhibernate-core/pull/505","diff_url":"https://github.com/nhibernate/nhibernate-core/pull/505.diff","patch_url":"https://github.com/nhibernate/nhibernate-core/pull/505.patch"},"body":"This translates the IndexOf (locate) result back into 0-based index space (NH-3901) and translates the `startAt` position into 1-based index space (NH-3846). \n"},"comment":{"url":"https://api.github.com/repos/nhibernate/nhibernate-core/issues/comments/258574846","html_url":"https://github.com/nhibernate/nhibernate-core/pull/505#issuecomment-258574846","issue_url":"https://api.github.com/repos/nhibernate/nhibernate-core/issues/505","id":258574846,"user":{"login":"hazzik","id":144791,"avatar_url":"https://avatars.githubusercontent.com/u/144791?v=3","gravatar_id":"","url":"https://api.github.com/users/hazzik","html_url":"https://github.com/hazzik","followers_url":"https://api.github.com/users/hazzik/followers","following_url":"https://api.github.com/users/hazzik/following{/other_user}","gists_url":"https://api.github.com/users/hazzik/gists{/gist_id}","starred_url":"https://api.github.com/users/hazzik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hazzik/subscriptions","organizations_url":"https://api.github.com/users/hazzik/orgs","repos_url":"https://api.github.com/users/hazzik/repos","events_url":"https://api.github.com/users/hazzik/events{/privacy}","received_events_url":"https://api.github.com/users/hazzik/received_events","type":"User","site_admin":false},"created_at":"2016-11-04T23:54:30Z","updated_at":"2016-11-04T23:54:30Z","body":"But in HQL you do not need to extract -1, as it shall have the SQL meaning\nof return value, not C#'s\nOn Sat, 5 Nov 2016 at 9:37 AM, Duncan Munro <notifications@github.com>\nwrote:\n\n> I needed to fix both. There are a few different bugs here because the\n> tests never actually checked for expected results.\n>\n> The changes to IndexOfGenerator fix the offset issue. SQL \"locate\" uses\n> 1-based indexing with 0 as the return value for NOT FOUND, so we need to\n> add one to the startAt index and subtract 1 from the result to get the\n> expected C# results.\n>\n> The changes to PositionSubstringFunction and CharIndexFunction fix a\n> different (and subtler) bug that appears when the dialect doesn't directly\n> support \"locate\" with a startAt value. The dialect supports it by\n> searching for the IndexOf in a substring and then subtracting the startAt\n> offset. However, as it was written it did not take into account a result of\n> 0 (NOT FOUND) in the substring. If the IndexOf in the substring returns 0\n> then the entire block should return 0. This is then wrapped by the subtract\n> 1 from above to return -1 to C#. I don't see how I could do this inside of\n> IndexOfGenerator, as this applies only to dialects that don't support a\n> offset for \"locate\".\n>\n> Finally, the changes to ExpressionParameterVisitor fix a problem with the\n> char versions of IndexOf where the parameter is being sent as a fixed\n> length string instead of a varchar. If the parameter is sent/interpreted\n> incorrectly (SQL Server, I think) then we wind up trying to locate a in\n> alberta. The changes here just ensure all char parameters are sent as\n> string, which is always interpreted as a varchar, as far as I can tell.\n>\n> —\n> You are receiving this because you commented.\n>\n>\n> Reply to this email directly, view it on GitHub\n> <https://github.com/nhibernate/nhibernate-core/pull/505#issuecomment-258541165>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/AAI1lwViwIoCBdfZfctrFaKcB0QL-m92ks5q65eKgaJpZM4JraSM>\n> .\n>\n"}}
{"actor":{"display_login":"hazzik"}}