xh / hoist-core

🏗️ The XH Hoist toolkit for Grails
https://xh.io/
Apache License 2.0
7 stars 2 forks source link

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

Closed jskupsik closed 3 months ago

jskupsik commented 3 months ago

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 commented 3 months ago

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

amcclain commented 3 months ago

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

amcclain commented 3 months ago

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 commented 3 months ago

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