Skip to content
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.rb is too heavy #70

Open
kwerle opened this issue Jan 22, 2015 · 0 comments
Open

sqlserver.rb is too heavy #70

kwerle opened this issue Jan 22, 2015 · 0 comments

Comments

@kwerle
Copy link
Contributor

kwerle commented Jan 22, 2015

The sqlserver adapter drops and creates a function every time the class is loaded.

In a corporate production environment, dropping and adding functions is often strictly controlled.

What's more, if you're running more than one instance of the app, there is a chance that instance 2 will fire up and drop the function while instance 1 is trying to use the function.

Finally, if you're using flat_distance_sql instead of sphere_distance_sql, you will never need the created function.

For all these reasons, I think the creation of that sql function should be a class method, not run on load. It should be a one-time operation for any database that the developer should be responsible for running - say in a migration or what have you. Ideally you should catch the appropriate sql error that would result from calling sphere_distance_sql without that method and document what the developer needs to do to make it work.

p.s. I hate sql server for not having a least function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant