gpt4 book ai didi

mysql - 如何知道mysql数据库中的数据是否更新或发生错误

转载 作者:行者123 更新时间:2023-11-30 22:58:43 25 4
gpt4 key购买 nike

我建立了一个网站。我的服务器端是用 node (express) 编写的。我使用连接到 mysql 数据库来更新数据。更新是通过调用存储过程完成的。连接是:

connection.query("call update_user(?)",id,
function(err, results)
{
connection.release();
});
}
});

我想知道结果对象包含什么。当我记录它时:

console.log(result);

我得到输出:“[Object object]”。

这不是我想要的。

那么结果对象的属性是什么?

最佳答案

我不知道发生了什么变化,但突然间它起作用了!当我记录结果时,我得到:

{ fieldCount: 0,
affectedRows: 1,
insertId: 0,
serverStatus: 2,
warningCount: 0,
message: '',
protocol41: true,
changedRows: 0 }

所以我知道数据是否发生了变化。

关于mysql - 如何知道mysql数据库中的数据是否更新或发生错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25037242/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com