MCPcopy
hub / github.com/turbot/steampipe / executeQuery

Method executeQuery

pkg/interactive/interactive_client.go:392–412  ·  view source on GitHub ↗
(ctx context.Context, queryCtx context.Context, resolvedQuery *modconfig.ResolvedQuery)

Source from the content-addressed store, hash-verified

390}
391
392func (c *InteractiveClient) executeQuery(ctx context.Context, queryCtx context.Context, resolvedQuery *modconfig.ResolvedQuery) {
393 // if there is a custom search path, wait until the first connection of each plugin has loaded
394 if customSearchPath := c.client().GetCustomSearchPath(); customSearchPath != nil {
395 if err := connection_sync.WaitForSearchPathSchemas(ctx, c.client(), customSearchPath); err != nil {
396 error_helpers.ShowError(ctx, err)
397 return
398 }
399 }
400
401 t := time.Now()
402 result, err := c.client().Execute(queryCtx, resolvedQuery.ExecuteSQL, resolvedQuery.Args...)
403 if err != nil {
404 error_helpers.ShowError(ctx, error_helpers.HandleCancelError(err))
405 // if timing flag is enabled, show the time taken for the query to fail
406 if cmdconfig.Viper().GetString(pconstants.ArgTiming) != pconstants.ArgOff {
407 querydisplay.DisplayErrorTiming(t)
408 }
409 } else {
410 c.promptResult.Streamer.StreamResult(result.Result)
411 }
412}
413
414func (c *InteractiveClient) getQuery(ctx context.Context, line string) *modconfig.ResolvedQuery {
415 // if it's an empty line, then we don't need to do anything

Callers 1

executorMethod · 0.95

Calls 7

clientMethod · 0.95
WaitForSearchPathSchemasFunction · 0.92
ShowErrorFunction · 0.92
HandleCancelErrorFunction · 0.92
ViperFunction · 0.92
GetCustomSearchPathMethod · 0.65
ExecuteMethod · 0.65

Tested by

no test coverage detected