java.sql.PreparedStatement.executeUpdate 返回受影响
当我执行一个语句:
1
|
UPDATE t_friend SET friend_list=1930 WHERE accountID=2040 |
的时候, 我知道受影响的结果肯定是0行. 因为我在linux上测试了, 测试数据如下:
1
2
3
4
5
6
7
8
9
10
11
|
mysql> select friend_list from t_friend where accountID=2040; + -------------+ | friend_list | + -------------+ | 1930 | + -------------+ 1 row in set (0.00 sec) mysql> UPDATE t_friend SET friend_list=1930 WHERE accountID=2040; Query OK, 0 rows affected (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 0 |
上面明确指出: matched: 1 Changed: 0 Warnings: 0
而我所需要的正是 Changed: 0; 而不是 matched: 1
但是现在我发现当我在java代码里使用java.sql.PreparedStatement.executeUpdate
他给我发挥的结果是matched
--------------------------------
以上, 我有什么办法解决吗?