MCPcopy Index your code
hub / github.com/pocketbase/pocketbase / normalizeViewSelectQuery

Function normalizeViewSelectQuery

core/view.go:272–282  ·  view source on GitHub ↗

------------------------------------------------------------------- Raw query to schema helpers ------------------------------------------------------------------- loosely normalizes the specified view query and warn against multiple inline statements (the check is not perfect and it is NOT intended

(dangerousSelectQuery string)

Source from the content-addressed store, hash-verified

270// loosely normalizes the specified view query and warn against multiple inline statements
271// (the check is not perfect and it is NOT intended as a security measure; it is done primarily to provide a helpful error message)
272func normalizeViewSelectQuery(dangerousSelectQuery string) (string, error) {
273 dangerousSelectQuery = strings.Trim(strings.TrimSpace(dangerousSelectQuery), ";")
274
275 tk := tokenizer.NewFromString(dangerousSelectQuery)
276 tk.Separators(';')
277 if queryParts, _ := tk.ScanAll(); len(queryParts) > 1 {
278 return "", errors.New("multiple statements are not supported")
279 }
280
281 return dangerousSelectQuery, nil
282}
283
284type queryField struct {
285 // field is the final resolved field.

Callers 2

SaveViewMethod · 0.85
DryRunViewMethod · 0.85

Calls 3

NewFromStringFunction · 0.92
SeparatorsMethod · 0.80
ScanAllMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…