------------------------------------------------------------------- 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)
| 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) |
| 272 | func 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 | |
| 284 | type queryField struct { |
| 285 | // field is the final resolved field. |
no test coverage detected
searching dependent graphs…