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. |
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}}