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

Function act_create_view

src/gpre/sql.cpp:2089–2146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2087//
2088
2089static act* act_create_view()
2090{
2091 gpre_req* request = MSC_request(REQ_ddl);
2092 gpre_rel* relation = par_relation(request);
2093
2094 // create action block
2095
2096 act* action = MSC_action(request, ACT_create_view);
2097 action->act_whenever = gen_whenever();
2098 action->act_object = (ref*) relation;
2099
2100 // if field list is present parse it and create corresponding field blocks
2101
2102 if (MSC_match(KW_LEFT_PAREN))
2103 {
2104 gpre_fld** ptr = &relation->rel_fields;
2105 for (;;)
2106 {
2107 *ptr = make_field(relation);
2108 ptr = &(*ptr)->fld_next;
2109 if (MSC_match(KW_RIGHT_PAREN))
2110 break;
2111 MSC_match(KW_COMMA);
2112 }
2113 }
2114
2115 // skip 'AS SELECT'
2116
2117 if (!MSC_match(KW_AS))
2118 CPR_s_error("AS");
2119
2120 relation->rel_view_text = CPR_start_text();
2121 if (!MSC_match(KW_SELECT))
2122 CPR_s_error("SELECT");
2123
2124 // reserve context variable 0 for view
2125
2126 request->req_internal++;
2127
2128 // parse the view SELECT
2129
2130 gpre_rse* select = SQE_select(request, true);
2131 relation->rel_view_rse = select;
2132 EXP_rse_cleanup(select);
2133
2134 if (MSC_match(KW_WITH))
2135 {
2136 if (!MSC_match(KW_CHECK))
2137 CPR_s_error("CHECK");
2138 if (!MSC_match(KW_OPTION))
2139 CPR_s_error("OPTION");
2140 relation->rel_flags |= REL_view_check;
2141 }
2142
2143 CPR_end_text(relation->rel_view_text);
2144
2145 return action;
2146}

Callers 1

act_createFunction · 0.85

Calls 11

MSC_requestFunction · 0.85
par_relationFunction · 0.85
MSC_actionFunction · 0.85
MSC_matchFunction · 0.85
make_fieldFunction · 0.85
CPR_s_errorFunction · 0.85
CPR_start_textFunction · 0.85
SQE_selectFunction · 0.85
EXP_rse_cleanupFunction · 0.85
CPR_end_textFunction · 0.85
gen_wheneverFunction · 0.70

Tested by

no test coverage detected