discord.js better-sqlite3 添加实际上并不是添加先前 const 的结果

discord.js better-sqlite3 addition is not actually adding the result from a previous const

if (command == "tgive") {
      //Get their current balance
    const grab = sql.prepare(`SELECT bal FROM ${args[1]}`).get();
    //Grab the value from the first input after the second. Ex: eco tgive 5 Juliana
    const pointsToAdd = parseInt(args[0]);
    //Add the two values from the database and the args[0] input
    const result = +grab.bal + +pointsToAdd;
    //Replace the curret value from column bal in table ${args[1]}, with the const result
    sql.prepare(`REPLACE INTO ${args[1]} (bal) VALUES ('${result}');`).run();
    message.channel.send(`You have ${grab.bal}`);

}
});

在数据库"Juliana"中,列bal的值是420,然而,每当我运行这条命令的值为5,我得到 You have 420,而不是 You have 425,这意味着命令没有添加来自 const result

的值
const grab = sql.prepare(`SELECT bal FROM ${args[1]}`).get();

当这行代码运行时,它会从数据库中检索值并对其进行复制。这意味着当数据库更新时,grab 的值不是。

如果要获取新余额,则需要重新查询数据库。