1

我没看到什么?我不知道为什么会收到此错误。它甚至不应该要求一个整数。

MariaDB [ams]> describe server_current_status;
+----------+-------------+------+-----+---------+----------------+
| Field    | Type        | Null | Key | Default | Extra          |
+----------+-------------+------+-----+---------+----------------+
| id       | int(11)     | NO   | PRI | NULL    | auto_increment |
| serverid | varchar(20) | YES  |     | NULL    |                |
| status   | varchar(20) | YES  |     | NULL    |                |
| notify   | varchar(15) | YES  |     | NULL    |                |
| totime   | varchar(20) | YES  |     | NULL    |                |
| fromtime | varchar(20) | YES  |     | NULL    |                |
+----------+-------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)

MariaDB [ams]> UPDATE server_current_status SET notify = 'SOME' AND status = 'DOWN' WHERE serverid = '8';
Query OK, 0 rows affected, 2 warnings (0.04 sec)
Rows matched: 1  Changed: 0  Warnings: 2

MariaDB [ams]> show warnings;
+---------+------+-------------------------------------------+
| Level   | Code | Message                                   |
+---------+------+-------------------------------------------+
| Warning | 1292 | Truncated incorrect INTEGER value: 'SOME' |
| Warning | 1292 | Truncated incorrect DOUBLE value: 'SOME'  |
+---------+------+-------------------------------------------+
2 rows in set (0.00 sec)
4

1 回答 1

3
notify = 'SOME' AND status = 'DOWN'

这是一个布尔表达式。引擎将其读取为

notify = ('SOME' AND (status = 'DOWN'))

因此引擎尝试转换'SOME'为布尔值(01MySQL/MariaDB 中)

你可能想要这个:

notify = 'SOME', status = 'DOWN'
于 2017-05-19T19:05:42.880 回答