SCADA-LTS / Scada-LTS

Scada-LTS is an Open Source, web-based, multi-platform solution for building your own SCADA (Supervisory Control and Data Acquisition) system.
GNU General Public License v2.0
727 stars 292 forks source link

issue in Alarms page (extra '(' in SQL query) #501

Closed joaoleal closed 4 years ago

joaoleal commented 6 years ago

Hello,

I've just installed version 0.9.3 of ScadaLTS from the github releases. When I go to the alarms page I get the following message:

PreparedStatementCallback; bad SQL grammar [select e.id, e.typeId, e.typeRef1, e.typeRef2,e.activeTs,e.rtnApplicable, e.rtnTs,e.rtnCause, e.alarmLevel, e.message, e.ackTs, e.ackUserId, u.username,e.alternateAckSource, ue.silenced from events e left join users u on e.ackUserId=u.id left join userEvents ue on e.id=ue.eventId where ue.userId=? and ((e.ackTs is null or e.ackTs=0) order by e.ackTs desc LIMIT  ? ]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by e.ackTs desc LIMIT  100' at line 1

It appears there is an extra '(' in

((e.ackTs is null or e.ackTs=0)

This comes from: Scada-LTS/src/org/scada_lts/dao/event/EventDAO.java probably from the string EVENT_FILTER_USER.

P.S. - great project! :)

Limraj commented 4 years ago

Problem is solved: https://github.com/SCADA-LTS/Scada-LTS/issues/1063