-
Notifications
You must be signed in to change notification settings - Fork 934
NH-3630 - Add bitwise operation support for dialects using internal/external functions #280
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
Conversation
RegisterFunction("bor", new BitwiseNativeOperation("|")); | ||
RegisterFunction("bxor", new BitwiseNativeOperation("^")); | ||
RegisterFunction("bnot", new BitwiseNativeOperation("~")); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In HQL you can write anyRandomFunctionName(x,y) and if the HQL parser doesn't recognize it, the call will be copied directly into the SQL. Have you verified that no supported database directly supports the band, bor, bxor and bnot as function names? If any does, this may cause a regression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it won't. It will get passed to sql just as did before.
The Intention is that " & ", " | ", " ^ " and " ~ " will be identified by the SQLGenerator class as Bitwise operations.
For the SqlGenerator to call the proper function on the dialect it searches internally for functions named band, bor, bxor and bnot.
Hence if the HQL code does directly call band, bor etc. they won't be recognized at all and thus will get passed directly to SQL.
@amroel can you please clean-up this pull request (rebase on top of master) and add some other dialects? |
Also, I would like have grammar unchanged and instead change linq to hql generator to use functions instead of operators (like this has been done with concat) |
@hazzik What is the reasoning behind leaving the grammer unchanged? |
I think it is better to be explicit rather than make some tricky changes |
Sorry @hazzik, but I still don't get it :) |
e1f4b5b
to
552b3a7
Compare
@amroel can you please rebase this on top of master? This will require grammar regeneration as well. |
…ied as "band", "bor", "bxor" and "bnot" which can be overriden by Subclasses of Dialect
@hazzik Done. |
NH-3630 - Add bitwise operation support for dialects using internal/external functions
https://nhibernate.jira.com/browse/NH-3630
Changes to SqlGenerator and Dialect to allow injection of vendor specific bitwise functions
+
Bitwise functions for firebird