[ https://issues.apache.org/jira/browse/PHOENIX-3572?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15957440#comment-15957440 ]
ASF GitHub Bot commented on PHOENIX-3572: ----------------------------------------- Github user JamesRTaylor commented on a diff in the pull request: https://github.com/apache/phoenix/pull/229#discussion_r109999394 --- Diff: phoenix-core/src/main/antlr3/PhoenixSQL.g --- @@ -742,7 +751,26 @@ upsert_column_refs returns [Pair<List<ColumnDef>,List<ColumnName>> ret] : d=dyn_column_name_or_def { if (d.getDataType()!=null) { $ret.getFirst().add(d); } $ret.getSecond().add(d.getColumnDefName()); } (COMMA d=dyn_column_name_or_def { if (d.getDataType()!=null) { $ret.getFirst().add(d); } $ret.getSecond().add(d.getColumnDefName()); } )* ; - + +// Parse a full declare cursor expression structure. +declare_cursor_node returns [DeclareCursorStatement ret] + : DECLARE c=cursor_name CURSOR FOR s=select_node + {ret = factory.declareCursor(c, s); } + ; + +cursor_open_node returns [OpenStatement ret] + : OPEN c=cursor_name {ret = factory.open(c);} + ; + +cursor_close_node returns [CloseStatement ret] + : CLOSE c=cursor_name {ret = factory.close(c);} + ; + +cursor_fetch_node returns [FetchStatement ret] + : FETCH NEXT (a=NUMBER)? (ROW|ROWS)? FROM c=cursor_name {ret = factory.fetch(c,true, a == null ? 1 : Integer.parseInt( a.getText() )); } + | FETCH PRIOR (a=NUMBER)? (ROW|ROWS)? FROM c=cursor_name {ret = factory.fetch(c,false, a == null ? 1 : Integer.parseInt( a.getText() )); } --- End diff -- How is FETCH PRIOR implemented? > Support FETCH NEXT| n ROWS from Cursor > -------------------------------------- > > Key: PHOENIX-3572 > URL: https://issues.apache.org/jira/browse/PHOENIX-3572 > Project: Phoenix > Issue Type: Sub-task > Reporter: Biju Nair > Assignee: Biju Nair > > Implement required changes to support > - {{DECLARE}} and {{OPEN}} a cursor > - query {{FETCH NEXT | n ROWS}} from the cursor > - {{CLOSE}} the cursor > Based on the feedback in [PR > #192|https://github.com/apache/phoenix/pull/192], implement the changes using > {{ResultSet}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)