gpt4 book ai didi

node.js oracledb 不插入也不更新

转载 作者:行者123 更新时间:2023-12-01 09:53:14 25 4
gpt4 key购买 nike

Node oracledb 版本 1.2
Node v0.12.7

按预期选择工作。
对于更新和插入,虽然我们得到了 rowsAffected: 1,但插入或更新不受影响。

var oracledb = require('oracledb');



oracledb.getConnection(
{
user: "HRTest",
password: "********",
connectString: "localhost/XE"
},
function (err, connection) {
if (err) {
console.error(err.message);
return;
}
connection.execute(
"UPDATE TBCUSTOMERDetails set FIRSTNAME=:fn WHERE id=:id ",
{fn: 'new name', id: 1},



function (err, result) {
if (err) {
console.error(err.message);
return;
}
console.log(result);

connection.release(
function (err) {
if (err) {
console.error(err.message);
throw(err);

}
else console.log("released connection");
}); // end release
}); // end function


});</code></pre>

最佳答案

感谢 daivrz,提交修复了问题,node-oracle 的默认值为 false。

var oracledb = require('oracledb');
oracledb.autoCommit = true;

关于node.js oracledb 不插入也不更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33777634/

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