tencent cloud

最終更新日:2025-03-11 20:05:05
Result
最終更新日: 2025-03-11 20:05:05
Result is the result returned by Database.exec.

Field

Field
Type
Description
lastInsertId?
number
Return an integer generated by the database in response to the command; this will typically come from the "Auto-Increment" column when inserting a new row.
rowsAffected?
number
Return the number of rows affected by the update, insert, or delete operation.

Samples

Use exec to execute a database query, and Result is returned:
import sql from 'pts/sql';

// Create a database instance using new.
const db = new sql.Database(sql.MySQL, "user:passwd@tcp(ip:port)/database")

export default function () {
let result = db.exec("UPDATE user SET age=? WHERE name='zhangsan'", Math.floor(Math.random() * 100));
console.log(JSON.stringify(result)); // {"lastInsertId":0,"rowsAffected":1}
}

この記事はお役に立ちましたか?
営業担当者に お問い合わせ いただくか チケットを提出 してサポートを求めることができます。
はい
いいえ

フィードバック