| 2261 | // |
| 2262 | |
| 2263 | static act* par_modify() |
| 2264 | { |
| 2265 | |
| 2266 | // Set up modify and action blocks. This is done here to leave the |
| 2267 | // structure in place to cleanly handle END_MODIFY under error conditions. |
| 2268 | |
| 2269 | upd* modify = (upd*) MSC_alloc(UPD_LEN); |
| 2270 | MSC_push((gpre_nod*) modify, &cur_modify); |
| 2271 | |
| 2272 | // If the next token isn't a context variable, we can't continue |
| 2273 | |
| 2274 | gpre_sym* symbol = gpreGlob.token_global.tok_symbol; |
| 2275 | if (!symbol || symbol->sym_type != SYM_context) |
| 2276 | { |
| 2277 | SCHAR s[ERROR_LENGTH]; |
| 2278 | fb_utils::snprintf(s, sizeof(s), "%s is not a valid context variable", gpreGlob.token_global.tok_string); |
| 2279 | PAR_error(s); |
| 2280 | } |
| 2281 | |
| 2282 | gpre_ctx* source = symbol->sym_object; |
| 2283 | gpre_req* request = source->ctx_request; |
| 2284 | if (request->req_type != REQ_for && request->req_type != REQ_cursor) |
| 2285 | PAR_error("invalid context for modify"); |
| 2286 | |
| 2287 | act* action = MSC_action(request, ACT_modify); |
| 2288 | action->act_object = (ref*) modify; |
| 2289 | |
| 2290 | PAR_get_token(); |
| 2291 | MSC_match(KW_USING); |
| 2292 | |
| 2293 | // Make an update context by cloning the source context |
| 2294 | |
| 2295 | gpre_ctx* update = MSC_context(request); |
| 2296 | update->ctx_symbol = source->ctx_symbol; |
| 2297 | update->ctx_relation = source->ctx_relation; |
| 2298 | |
| 2299 | // Make an update block to hold everything known about the modify |
| 2300 | |
| 2301 | modify->upd_request = request; |
| 2302 | modify->upd_source = source; |
| 2303 | modify->upd_update = update; |
| 2304 | modify->upd_level = ++request->req_level; |
| 2305 | |
| 2306 | return action; |
| 2307 | } |
| 2308 | |
| 2309 | |
| 2310 | //____________________________________________________________ |
no test coverage detected