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

Function getStatementWithResultLimit

backend/plugin/db/mysql/query.go:90–98  ·  view source on GitHub ↗
(statement string, limit int)

Source from the content-addressed store, hash-verified

88}
89
90func getStatementWithResultLimit(statement string, limit int) string {
91 stmt, err := getStatementWithResultLimitInline(statement, limit)
92 if err != nil {
93 slog.Error("fail to add limit clause", slog.String("statement", statement), log.BBError(err))
94 // MySQL 5.7 doesn't support WITH clause.
95 return fmt.Sprintf("SELECT * FROM (%s) result LIMIT %d;", util.TrimStatement(statement), limit)
96 }
97 return stmt
98}
99
100func getStatementWithResultLimitInline(statement string, limitCount int) (string, error) {
101 if strings.TrimSpace(statement) == "" {

Calls 5

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