tencent cloud

All product documents
Tencent Cloud Observability Platform
Last updated: 2025-03-11 20:05:05
Result
Last updated: 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}
}

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon