MCPcopy Index your code
hub / github.com/bytebase/bytebase / LogCommandExecute

Method LogCommandExecute

backend/plugin/db/driver.go:289–306  ·  view source on GitHub ↗

LogCommandExecute logs the execution of a command.

(commandRange *storepb.Range, commandText string)

Source from the content-addressed store, hash-verified

287
288// LogCommandExecute logs the execution of a command.
289func (o *ExecuteOptions) LogCommandExecute(commandRange *storepb.Range, commandText string) {
290 if o == nil || o.CreateTaskRunLog == nil {
291 return
292 }
293 ce := &storepb.TaskRunLog_CommandExecute{}
294 if o.LogCommandStatement {
295 ce.Statement = commandText
296 } else {
297 ce.Range = commandRange
298 }
299 err := o.CreateTaskRunLog(time.Now(), &storepb.TaskRunLog{
300 Type: storepb.TaskRunLog_COMMAND_EXECUTE,
301 CommandExecute: ce,
302 })
303 if err != nil {
304 slog.Warn("failed to log command execute", log.BBError(err))
305 }
306}
307
308func (o *ExecuteOptions) LogCommandResponse(affectedRows int64, allAffectedRows []int64, rerr string) {
309 if o == nil || o.CreateTaskRunLog == nil {

Callers 15

ExecuteMethod · 0.80
ExecuteMethod · 0.80
ExecuteMethod · 0.80

Calls 2

BBErrorFunction · 0.92
CreateTaskRunLogMethod · 0.80

Tested by

no test coverage detected