| 2384 | // |
| 2385 | |
| 2386 | static gpre_nod* par_plan_item(gpre_req* request, bool /*aster_ok*/, USHORT* /*paren_count*/, bool* /*bool_flag*/) |
| 2387 | { |
| 2388 | assert_IS_REQ(request); |
| 2389 | |
| 2390 | // check for a plan expression |
| 2391 | |
| 2392 | tok& token = gpreGlob.token_global; |
| 2393 | |
| 2394 | switch (token.tok_keyword) |
| 2395 | { |
| 2396 | case KW_JOIN: |
| 2397 | case KW_SORT: |
| 2398 | case KW_MERGE: |
| 2399 | case KW_LEFT_PAREN: |
| 2400 | return par_plan(request); |
| 2401 | } |
| 2402 | |
| 2403 | // parse the list of one or more table names or |
| 2404 | // aliases (more than one is used when there is |
| 2405 | // a need to differentiate base tables of a view) |
| 2406 | |
| 2407 | int count; |
| 2408 | gpre_lls* stack = NULL; |
| 2409 | for (count = 0; token.tok_type == tok_ident; count++) |
| 2410 | { |
| 2411 | if (token.tok_keyword == KW_NATURAL || token.tok_keyword == KW_ORDER || |
| 2412 | token.tok_keyword == KW_INDEX) |
| 2413 | { |
| 2414 | break; |
| 2415 | } |
| 2416 | |
| 2417 | MSC_push((gpre_nod*) upcase_string(token.tok_string), &stack); |
| 2418 | PAR_get_token(); |
| 2419 | } |
| 2420 | |
| 2421 | if (!count) |
| 2422 | CPR_s_error("<table name> or <alias>"); |
| 2423 | |
| 2424 | gpre_nod** ptr; |
| 2425 | |
| 2426 | gpre_nod* alias_list = MSC_node(nod_list, (SSHORT) count); |
| 2427 | for (ptr = &alias_list->nod_arg[count]; stack;) |
| 2428 | *--ptr = (gpre_nod*) MSC_pop(&stack); |
| 2429 | |
| 2430 | // lookup the contexts for the aliases |
| 2431 | |
| 2432 | gpre_nod* index_list = NULL; |
| 2433 | gpre_ctx* context = par_alias_list(request, alias_list); |
| 2434 | |
| 2435 | // parse the access type |
| 2436 | |
| 2437 | gpre_nod* access_type = NULL; |
| 2438 | switch (token.tok_keyword) |
| 2439 | { |
| 2440 | case KW_NATURAL: |
| 2441 | access_type = MSC_node(nod_natural, 0); |
| 2442 | PAR_get_token(); |
| 2443 | break; |
nothing calls this directly
no test coverage detected