MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / par_select

Function par_select

src/gpre/sqe.cpp:2975–3030  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2973//
2974
2975static gpre_rse* par_select( gpre_req* request, gpre_rse* union_rse)
2976{
2977 assert_IS_REQ(request);
2978
2979 // Handle FIRST and SKIP clauses
2980 gpre_nod* rse_first = NULL;
2981 if (MSC_match(KW_FIRST))
2982 {
2983 rse_first = MSC_node(nod_list, 1);
2984 rse_first->nod_arg[0] = SQE_value(request, false, NULL, NULL);
2985 }
2986
2987 gpre_nod* rse_skip = NULL;
2988 if (MSC_match(KW_SKIP))
2989 {
2990 rse_skip = MSC_node(nod_list, 1);
2991 rse_skip->nod_arg[0] = SQE_value(request, false, NULL, NULL);
2992 }
2993
2994 // Handle the ALL and DISTINCT options
2995
2996 const bool distinct = (!MSC_match(KW_ALL) && MSC_match(KW_DISTINCT));
2997
2998 // Make select list out of select items
2999
3000 ++request->req_in_select_list;
3001 gpre_nod* s_list = SQE_list(SQE_value_or_null, request, true);
3002 --request->req_in_select_list;
3003
3004 // If this is not a declare cursor statement and an INTO list is present,
3005 // parse it.
3006
3007 gpre_nod* into_list = NULL;
3008 if (!(request->req_flags & REQ_sql_declare_cursor))
3009 {
3010 into_list = MSC_match(KW_INTO) ? SQE_list(SQE_variable, request, false) : NULL;
3011 }
3012
3013 gpre_rse* select = par_rse(request, s_list, distinct);
3014
3015 if (rse_first)
3016 resolve_fields(rse_first, select);
3017 select->rse_sqlfirst = rse_first;
3018
3019 if (rse_skip)
3020 resolve_fields(rse_skip, select);
3021 select->rse_sqlskip = rse_skip;
3022
3023 if ((select->rse_into = into_list))
3024 select->rse_flags |= RSE_singleton;
3025
3026 if (union_rse && s_list->nod_count != union_rse->rse_fields->nod_count)
3027 PAR_error("select lists for UNION don't match");
3028
3029 return select;
3030}
3031
3032

Callers 1

SQE_selectFunction · 0.85

Calls 7

MSC_matchFunction · 0.85
MSC_nodeFunction · 0.85
SQE_valueFunction · 0.85
SQE_listFunction · 0.85
par_rseFunction · 0.85
resolve_fieldsFunction · 0.85
PAR_errorFunction · 0.70

Tested by

no test coverage detected