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

Function hasUnparsedTail

backend/plugin/db/starrocks/query.go:136–170  ·  view source on GitHub ↗
(sql string, locEnd int)

Source from the content-addressed store, hash-verified

134}
135
136func hasUnparsedTail(sql string, locEnd int) bool {
137 pos := locEnd
138 for pos < len(sql) {
139 for pos < len(sql) && (sql[pos] == ' ' || sql[pos] == '\t' || sql[pos] == '\n' || sql[pos] == '\r') {
140 pos++
141 }
142 for pos < len(sql) && sql[pos] == ';' {
143 pos++
144 }
145 for pos < len(sql) && (sql[pos] == ' ' || sql[pos] == '\t' || sql[pos] == '\n' || sql[pos] == '\r') {
146 pos++
147 }
148 if pos >= len(sql) {
149 return false
150 }
151 if strings.HasPrefix(sql[pos:], "--") || strings.HasPrefix(sql[pos:], "#") {
152 nl := strings.IndexByte(sql[pos:], '\n')
153 if nl < 0 {
154 return false
155 }
156 pos += nl + 1
157 continue
158 }
159 if strings.HasPrefix(sql[pos:], "/*") {
160 end := strings.Index(sql[pos:], "*/")
161 if end < 0 {
162 return false
163 }
164 pos += end + 2
165 continue
166 }
167 return true
168 }
169 return false
170}
171
172func rewriteSelectLimit(sql string, stmt *ast.SelectStmt, limitCount int) (string, error) {
173 if stmt.Limit != nil {

Callers 2

rewriteSelectLimitFunction · 0.85
rewriteSetOpLimitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected