增加两个数据库相关调试命令

This commit is contained in:
刘祥超
2022-04-08 15:09:33 +08:00
parent 4e18129c6c
commit ad416dddec
2 changed files with 42 additions and 2 deletions

View File

@@ -585,8 +585,22 @@ func (this *APINode) listenSock() error {
_ = cmd.Reply(&gosock.Command{
Params: map[string]interface{}{"debug": teaconst.Debug},
})
case "db.stmt":
dbs.ShowPreparedStatements = true
case "db.stmt.prepare":
dbs.ShowPreparedStatements = !dbs.ShowPreparedStatements
_ = cmd.Reply(&gosock.Command{
Params: map[string]interface{}{"isOn": dbs.ShowPreparedStatements},
})
case "db.stmt.count":
db, _ := dbs.Default()
if db != nil {
_ = cmd.Reply(&gosock.Command{
Params: map[string]interface{}{"count": db.StmtManager().Len()},
})
} else {
_ = cmd.Reply(&gosock.Command{
Params: map[string]interface{}{"count": 0},
})
}
}
})