exec(query: string, ...args: any[]): Result
Parameter | Type | Description |
query | string | Query Statement |
...args | any[ ] | Placeholder parameter used for querying. |
Type | Description |
Query the return results. |
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}}