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

Function EXP_relation

src/gpre/exp.cpp:645–694  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

643//
644
645gpre_rel* EXP_relation()
646{
647 if (!gpreGlob.isc_databases)
648 PAR_error("no database for operation");
649
650 // The current token is (i.e. should be) either a relation
651 // name or a database name. If it's a database name, search
652 // it for the relation name. If it's an unqualified relation
653 // name, search all databases for the name
654
655 gpre_rel* relation = NULL;
656
657 SQL_resolve_identifier("<identifier>", NULL, NAME_SIZE);
658 gpre_sym* symbol = MSC_find_symbol(gpreGlob.token_global.tok_symbol, SYM_database);
659 if (symbol)
660 {
661 gpre_dbb* db = (gpre_dbb*) symbol->sym_object;
662 PAR_get_token();
663 if (!MSC_match(KW_DOT))
664 CPR_s_error("period after database name");
665 SQL_resolve_identifier("<Table name>", NULL, NAME_SIZE);
666 relation = MET_get_relation(db, gpreGlob.token_global.tok_string, "");
667 }
668 else
669 {
670 for (gpre_dbb* db = gpreGlob.isc_databases; db; db = db->dbb_next)
671 {
672 gpre_rel* temp = MET_get_relation(db, gpreGlob.token_global.tok_string, "");
673 if (temp)
674 {
675 if (!relation)
676 relation = temp;
677 else
678 {
679 TEXT s[ERROR_LENGTH];
680 fb_utils::snprintf(s, sizeof(s), "relation %s is ambiguous", gpreGlob.token_global.tok_string);
681 PAR_get_token();
682 PAR_error(s);
683 }
684 }
685 }
686 }
687
688 if (!relation)
689 CPR_s_error("relation name");
690
691 PAR_get_token();
692
693 return relation;
694}
695
696
697//____________________________________________________________

Callers 5

EXP_contextFunction · 0.85
PAR_reservingFunction · 0.85
par_basedFunction · 0.85
par_derived_fromFunction · 0.85
par_typeFunction · 0.85

Calls 8

SQL_resolve_identifierFunction · 0.85
MSC_find_symbolFunction · 0.85
PAR_get_tokenFunction · 0.85
MSC_matchFunction · 0.85
CPR_s_errorFunction · 0.85
MET_get_relationFunction · 0.85
PAR_errorFunction · 0.70
snprintfFunction · 0.50

Tested by

no test coverage detected