The SQL update code in your readme document seems to have no conditions?
dong-lufei opened this issue · 1 comments
dong-lufei commented
let result = await client.execute(`update users set ?? = ?`, ["name", "MYR"]);
console.log(result);
// { affectedRows: 1, lastInsertId: 0 }
Conditions should be added, such as:
// # 更新数据表某数据
const updateResult = await client.execute(
`update users set ?? = ? where id=?`,
[
"name",
"lufei",
1,
],
);
lideming commented
I understand there is usually WHERE
clause in UPDATE
statements. But it's just a simple example to show how to execute SQL with field name parameter (??) and value parameter (?). Developers should write their own SQL statements and know what they're doing.