-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQL Server: translation for the PATINDEX function #33702
Comments
Hi @roji , I would be glad to work on this issue as my first contribution if it hasn't been worked on yet :) |
Sure thing, feel free to submit a PR! |
Thank you @roji! I'd like to share my plan and hopefully receive feedback/insights on whether or not I'm on the right track. Based on the discussion on 6159 and what I have learned from the codebase so far, I believe I should add a new |
The PatIndex would go on SqlServerDbFunctionsExtensions, not DbFunctionsExtensions, as it's a SQL Server-specific thing. And yeah, implementing the translation in SqlServerStringMethodTranslator makes sense. |
Hi, @roji I have a working branch (ready for PR) for this issue with a decent number of unity tests. In my solution, "PATINDEX" resides with SqlServerFullTextSearchFunctionsTranslator, and handles queries like
I added unit tests similar to those that exist for SqlServerStringMethodTranslator translates string methods, like Shall I move my changes to SqlServerStringMethodTranslator? |
Yes. "full text" in the SQL Server context means something very specific (see docs), and PATINDEX isn't part of that. In any case, where exactly the translator lives isn't very important. |
SQL Server has
PATINDEX
, which allows getting the index of a LIKE-like pattern (as opposed to just checking whether the pattern matches). EF6 hadSqlFunctions.PatIndex
.Raised by @irg1008 in #6159.
The text was updated successfully, but these errors were encountered: