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

Simplified the xhDbConnectionMonitor query to work with more SQL dialects #371

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

jskupsik
Copy link
Contributor

The existing query, SELECT * FROM xh_monitor WHERE code = 'xhDbConnectionMonitor' LIMIT 1, does not work in SQL Server (Microsoft SQL).
The equivalent statement in SQL Server would be SELECT TOP(1) * FROM xh_monitor WHERE code = 'xhDbConnectionMonitor'

I propose we simplify it to the SQL statement SELECT * FROM xh_monitor WHERE code = 'xhDbConnectionMonitor', which should work in all dialects.

@jskupsik jskupsik requested a review from lbwexler July 17, 2024 19:28
@jskupsik
Copy link
Contributor Author

We could also potentially do SELECT 1 FROM xh_monitor WHERE code = 'xhDbConnectionMonitor' - if we are worried about * fetching too much data.

@jskupsik jskupsik requested a review from amcclain July 17, 2024 19:58
@lbwexler lbwexler merged commit ab2e2bf into develop Jul 17, 2024
4 checks passed
@lbwexler lbwexler deleted the xhDbConnectionMonitorQueryFix branch July 17, 2024 21:05
@amcclain
Copy link
Member

Not sure why we had that LIMIT 1 in there given that code has a unique constraint - thanks for fixing!

@amcclain
Copy link
Member

Wish we had just made this configurable via params - found it failing on a deployment, went to adjust the monitor config then remembered this is hard-coded.

@lbwexler
Copy link
Member

I don't feel too bad about that -- I think this is more appropriate than config driven sql would have been

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

Successfully merging this pull request may close these issues.

3 participants