Simple Select Statement

1 post / 0 new
pedrorjbr
pedrorjbr's picture
Offline
Last seen: 1 month 6 days ago
Joined: Apr 9 2010
Junior Boarder

Posts: 4

Pedro Magalhaes
Simple Select Statement

I was looking at the source code of Infidb, specifically the grammar file (dml.y). I saw many references to statements UPDATE, INSERT, DELETE. But on the SELECT statment found weird. The SELECT statement is performed by this grammar? I didnt find any test case using a simple select in the dbcon\dmlpackage\sql folder.

I thought he always used a cursor to run a query but I ended up coming cursor_def = NULL.

 

How simple query (select * from table) are performed?

 

sql:
cursor_def { $$ = NULL;  }
;
cursor_def:
DECLARE cursor CURSOR FOR query_exp opt_order_by_clause
;
query_exp:
query_term
| query_exp UNION query_term
| query_exp UNION ALL query_term
;
query_term:
query_spec
| '(' query_exp ')'
;
query_spec:
SELECT opt_all_distinct selection table_exp
{
                $$ = new QuerySpec();
if (NULL != $2)
  $$->fOptionAllOrDistinct = $2; 
$$->fSelectFilterPtr = $3;
$$->fTableExpressionPtr = $4;
                 
}
;