Skip to content

SQL调试


isShowSql

留意前面的文档中都有提到这个字段,它是用来控制某个ORM动作的时候,是否将最终执行的SQL语句打印到控制台,默认不开启。

import { Db } from 'think-ts-db'
export default defineEventHandler(async (event) => {
    const user = await Db('user', mysqlConfig).select(true)
    return user
})
import { Db } from 'think-ts-db'
export default defineEventHandler(async (event) => {
    const user = await Db('user', mysqlConfig).select(true)
    return user
})

局部控制 isShowSql

SQL: SELECT * FROM user
SQL: SELECT * FROM user

备案号:冀ICP备20015584号-2