我正在尝试在nfsen中设置邮件插件(它是用perl编写的)
有时,插件会生成以下sql查询:
SELECT event_id FROM events WHERE Level="alarm" AND Type="botlist1" WHERE event_id NOT IN ( SELECT event_id FROM attributes WHERE Name="Notified")
这会提示错误:
事件:SQL错误:您的SQL语法中有错误;查看与您的MySQL服务器版本对应的手册,以便在第1行'WHERE event_id NOT IN(SELECT event_id FROM attributes WHERE Name =“Notified”)'附近使用正确的语法
我正在运行nfsen 1.3.7,mysql server 5.5以及事件和属性的表格布局是:
+------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+------------------+------+-----+---------+----------------+
| event_id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| starttime | int(10) | NO | | NULL | |
| stoptime | int(10) | YES | MUL | NULL | |
| updatetime | int(10) | NO | | NULL | |
| level | varchar(32) | NO | | NULL | |
| profile | varchar(100) | NO | | NULL | |
| type | varchar(32) | NO | | NULL | |
+------------+------------------+------+-----+---------+----------------+
+--------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+------------------+------+-----+---------+----------------+
| attribute_id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| event_id | int(10) unsigned | YES | MUL | NULL | |
| name | varchar(32) | YES | | NULL | |
| value | varchar(64) | YES | | NULL | |
+--------------+------------------+------+-----+---------+----------------+
编辑:不知道为什么这被标记为重复,链接问题中的问题似乎根本没有关系,因为这里的所有名称都不是保留关键字。