matthewwall / weewx-forecast

forecasting extension for weewx
GNU General Public License v3.0
4 stars 18 forks source link

syntax error in MySQL routine #13

Open mytechguyri opened 2 years ago

mytechguyri commented 2 years ago

Feb 11 04:13:30 direwolf daemon.err wxnow: forecast: ReportThread: get tides failed (attempt 3 of 3): (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'offset,usUnits,location from archive where method = 'XTide' and dateTime = (s...' at line 1")

MaffooClock commented 1 month ago

It's because offset is a reserved word, so it cannot be used in a query without being wrapped in back ticks (`).

The query is on line 4381: https://github.com/matthewwall/weewx-forecast/blob/b5ec213d44b3a781cdef16e68f3c1419a0201438/bin/user/forecast.py#L4381

Just edit /etc/weewx/bin/user/forecast.py (WeeWX v5.x) or /usr/share/weewx/user/forecast.py(WeeWX <= 4.x) and edit the line so that offset becomes `offset`.