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

Function SQE_field

src/gpre/sqe.cpp:338–679  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

336//
337
338gpre_nod* SQE_field(gpre_req* request, bool aster_ok)
339{
340 gpre_req* slice_req;
341
342 assert_IS_REQ(request);
343
344 gpre_lls* upper_dim = NULL;
345 gpre_lls* lower_dim = NULL;
346 tok hold_token;
347 hold_token.tok_type = tok_t(0);
348
349 if (aster_ok && MSC_match(KW_ASTERISK))
350 {
351 gpre_nod* node = MSC_node(nod_asterisk, 1);
352 return node;
353 }
354
355 // if the token isn't an identifier, complain
356
357 SQL_resolve_identifier("<column name>", NULL, NAME_SIZE);
358
359 // For domains we can't be resolving tokens to field names
360 // in the CHECK constraint.
361
362 TEXT s[ERROR_LENGTH];
363
364 act* action;
365 if (request && request->req_type == REQ_ddl && (action = request->req_actions) &&
366 (action->act_type == ACT_create_domain || action->act_type == ACT_alter_domain))
367 {
368 fb_utils::snprintf(s, sizeof(s), "Illegal use of identifier: %s in domain constraint",
369 gpreGlob.token_global.tok_string);
370 PAR_error(s);
371 }
372
373
374 // Note: We *always* want to make a deferred name block - to handle
375 // scoping of alias names in subselects properly, when we haven't
376 // seen the list of relations (& aliases for them). This occurs
377 // during the select list, but by the time we see the having, group,
378 // order, or where we do know all aliases and should be able to
379 // precisely match.
380 // Note that the case of request == NULL should never
381 // occur, and request->req_contexts == NULL should only
382 // occur for the very first select list in a request.
383 // 1994-October-03 David Schnepper
384
385 // if the request is null, make a deferred name block
386
387 if (!request || !request->req_contexts || request->req_in_select_list)
388 {
389 gpre_nod* node = MSC_node(nod_deferred, 3);
390 node->nod_count = 0;
391 tok* f_token = (tok*) MSC_alloc(TOK_LEN);
392 node->nod_arg[0] = (gpre_nod*) f_token;
393 f_token->tok_length = gpreGlob.token_global.tok_length;
394 SQL_resolve_identifier("<identifier>", f_token->tok_string, f_token->tok_length + 1);
395 CPR_token();

Callers 5

act_insertFunction · 0.85
act_updateFunction · 0.85
act_upsertFunction · 0.85
par_notFunction · 0.85
par_udf_or_fieldFunction · 0.85

Calls 15

tok_tEnum · 0.85
MSC_matchFunction · 0.85
MSC_nodeFunction · 0.85
SQL_resolve_identifierFunction · 0.85
MSC_allocFunction · 0.85
CPR_tokenFunction · 0.85
MSC_requestFunction · 0.85
par_subscriptFunction · 0.85
MSC_pushFunction · 0.85
CPR_s_errorFunction · 0.85
SLC_LENFunction · 0.85
MSC_popFunction · 0.85

Tested by

no test coverage detected