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

Function PASS1_check_unique_fields_names

src/dsql/pass1.cpp:682–712  ·  view source on GitHub ↗

PASS1_check_unique_fields_names check fields (params, variables, cursors etc) names against sorted array if success, add them into array **/

Source from the content-addressed store, hash-verified

680 if success, add them into array
681 **/
682void PASS1_check_unique_fields_names(StrArray& names, const CompoundStmtNode* fields)
683{
684 if (!fields)
685 return;
686
687 const NestConst<StmtNode>* ptr = fields->statements.begin();
688 const NestConst<StmtNode>* const end = fields->statements.end();
689
690 for (; ptr != end; ++ptr)
691 {
692 const char* name = NULL;
693
694 if (auto varNode = nodeAs<DeclareVariableNode>(*ptr))
695 name = varNode->dsqlDef->name.c_str();
696 else if (auto cursorNode = nodeAs<DeclareCursorNode>(*ptr))
697 name = cursorNode->dsqlName.c_str();
698 else if (nodeAs<DeclareSubProcNode>(*ptr) || nodeAs<DeclareSubFuncNode>(*ptr))
699 continue;
700
701 fb_assert(name);
702
703 FB_SIZE_T pos;
704 if (!names.find(name, pos))
705 names.insert(pos, name);
706 else
707 {
708 ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-637) <<
709 Arg::Gds(isc_dsql_duplicate_spec) << Arg::Str(name));
710 }
711 }
712}
713
714
715// Compose two booleans.

Callers 1

dsqlPassMethod · 0.85

Calls 9

ERRD_postFunction · 0.85
GdsClass · 0.85
NumClass · 0.85
StrClass · 0.85
beginMethod · 0.45
endMethod · 0.45
c_strMethod · 0.45
findMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected