MCPcopy Create free account
hub / github.com/bytebase/bytebase / getStatementWithResultLimit

Function getStatementWithResultLimit

backend/plugin/db/snowflake/query.go:20–27  ·  view source on GitHub ↗
(statement string, limit int)

Source from the content-addressed store, hash-verified

18const stmtErrFmt = "statement: %s"
19
20func getStatementWithResultLimit(statement string, limit int) string {
21 stmt, err := getStatementWithResultLimitInline(statement, limit)
22 if err != nil {
23 slog.Error("fail to add limit clause", slog.String("statement", statement), log.BBError(err))
24 return fmt.Sprintf("SELECT * FROM (%s) LIMIT %d", util.TrimStatement(statement), limit)
25 }
26 return stmt
27}
28
29// getStatementWithResultLimitInline rewrites the single statement so that its
30// outermost query returns at most limitCount rows. The rewrite splices the

Callers 2

QueryConnMethod · 0.70
runLimitTestFunction · 0.70

Calls 5

BBErrorFunction · 0.92
TrimStatementFunction · 0.92
StringMethod · 0.65
ErrorMethod · 0.45

Tested by 1

runLimitTestFunction · 0.56