PASS1_check_unique_fields_names check fields (params, variables, cursors etc) names against sorted array if success, add them into array **/
| 680 | if success, add them into array |
| 681 | **/ |
| 682 | void 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. |