ParseReturnQuery handles reading and parsing the query for a RETURN QUERY statement, which can be nonexistent.
()
| 391 | // ParseReturnQuery handles reading and parsing the query for a RETURN QUERY |
| 392 | // statement, which can be nonexistent. |
| 393 | func (l *lexer) ParseReturnQuery() (plpgsqltree.Statement, error) { |
| 394 | startPos, endPos, _, err := l.readSQLConstruct(false /* isExpr */, false /* allowEmpty */, ';') |
| 395 | if err != nil || startPos == endPos { |
| 396 | return nil, err |
| 397 | } |
| 398 | queryStr := l.getStr(startPos, endPos) |
| 399 | stmt, err := parser.ParseOne(queryStr) |
| 400 | if err != nil { |
| 401 | return nil, err |
| 402 | } |
| 403 | ann := tree.MakeAnnotations(stmt.NumAnnotations) |
| 404 | return &plpgsqltree.ReturnQuery{ |
| 405 | SqlStmt: stmt.AST, |
| 406 | Annotations: &ann, |
| 407 | }, nil |
| 408 | } |
| 409 | |
| 410 | // peekForExecute checks whether the next token is EXECUTE, used to identify |
| 411 | // dynamic SQL statements. |
no test coverage detected