-
Notifications
You must be signed in to change notification settings - Fork 1.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
SqlServer - ATAN2 bearing calculation fails #532
Comments
SqlServer is not officially supported but if you want to write something up on the issues around using it I think that'd be a good candidate for a wiki page (which is coming soon). |
Thanks. I'll keep an eye out for when the wiki happens and see if I can contribute that way. |
I came across this issue today and worked around it as described below. This is old, but I wanted to leave a note here since this is directly relevant to this issue. I'm not sure if Alex would be open to a pull request to add such functionality, but generally speaking, the are two changes that should happen to the bearing related sql make this more smooth in SQL Server:
For my quick fix, I just overwrote the method. But if it were desirable to improve SQL Server support for this gem, here are my notes: There are already methods for detecting postgres and sqlite, so adding sqlserver detection wouldn't be too intrusive (reference Here is how I rewrote the method to accommodate SQL server. I added this to my initializers and it seems to work. https://gist.github.com/ttilberg/fe5ac60351ad33b865550c08857f612f |
I couldn't find any existing issues filed for this. Sorry if it is a duplicate.
I'm using SqlServer at work (grudgingly) and using the standard SomeModel.near method results in this error:
It looks like it is used to calculate the bearing. I am able to work around the problem by using something like:
But I had to dig through the source a bit for this. Maybe we should add some documentation about sql server or else change the default select_bearing option to be false when using TinyTds?
The text was updated successfully, but these errors were encountered: