Run the limit offset, count statement to perform pagination query, The number of records to be returned can be limited. The offset value is used to specify the number of records to be returned and the count value is used to specify the number of records to be returned.
If offset and count are not specified, the default values are offset=0 and count=5000, indicating that the first 5000 records in the result set are returned. The maximum number of count records can be set to 10000, indicating that the query interface can return only the first 10000 records in the query result set.
sql
Optional
options: SqlOptionsSQL execution options
Recordset
Run the SQL statement and use the'limit offset, count' statement to query the pagination, The number of returned records can be limited. The offset value specifies the start record, and the count value specifies the total number of returned records. If offset and count are not specified, the default values are offset=0 and count=5000, indicating that the first 5000 records in the result set are returned. The maximum value of count is 10000, indicating that the query interface can return only the first 10000 query results.
Optional
options: SqlOptions
import * as db from 'db';
@useObject(['student__cst'])
class Demo {
run: () => void {
let se = db.sql();
let sql = "select name, age__CST from student__CST where name = ? and age__CST = ?";
let value = se.execute(sql, { params: ['hello2', 'age2']});
}
}
let demo = new Demo();
demo.run();
async execute sql, usage please see execute
Optional
options: SqlOptions24.7.0 only js2.0 support
import * as db from 'db';
@useObject(['student__cst'])
class Demo {
run: () => void {
let se = db.sql();
let sql = "select name, age__CST from student__CST where name = ? and age__CST = ?";
let value = await se.executeAsync(sql, { params: ['hello2', 'age2']});
}
}
let demo = new Demo();
demo.run();
Output an SQL execution plan.
sql
Optional
options: SqlOptionsExecution Options
Execution plan information
import * as db from 'db';
let se = db.sql();
let plans = se.explain(
"select name, age__CST from student__CST where name = ? and age__CST = ?", { params: ['hello2', 'age2']});
SQL operation interface