| 918 | |
| 919 | |
| 920 | static PlanNode* par_plan(thread_db* tdbb, CompilerScratch* csb) |
| 921 | { |
| 922 | /************************************** |
| 923 | * |
| 924 | * p a r _ p l a n |
| 925 | * |
| 926 | ************************************** |
| 927 | * |
| 928 | * Functional description |
| 929 | * Parse an access plan expression. |
| 930 | * At this stage we are just generating the |
| 931 | * parse tree and checking contexts |
| 932 | * and indices. |
| 933 | * |
| 934 | **************************************/ |
| 935 | SET_TDBB(tdbb); |
| 936 | |
| 937 | auto blrOp = csb->csb_blr_reader.getByte(); |
| 938 | |
| 939 | // a join type indicates a cross of two or more streams |
| 940 | |
| 941 | if (blrOp == blr_join || blrOp == blr_merge) |
| 942 | { |
| 943 | // CVC: bottleneck |
| 944 | int count = (USHORT) csb->csb_blr_reader.getByte(); |
| 945 | PlanNode* plan = FB_NEW_POOL(csb->csb_pool) PlanNode(csb->csb_pool, PlanNode::TYPE_JOIN); |
| 946 | |
| 947 | while (count-- > 0) |
| 948 | plan->subNodes.add(par_plan(tdbb, csb)); |
| 949 | |
| 950 | return plan; |
| 951 | } |
| 952 | |
| 953 | // we have hit a stream; parse the context number and access type |
| 954 | |
| 955 | jrd_rel* relation = nullptr; |
| 956 | jrd_prc* procedure = nullptr; |
| 957 | |
| 958 | if (blrOp == blr_retrieve) |
| 959 | { |
| 960 | PlanNode* plan = FB_NEW_POOL(csb->csb_pool) PlanNode(csb->csb_pool, PlanNode::TYPE_RETRIEVE); |
| 961 | |
| 962 | // parse the relation name and context--the relation |
| 963 | // itself is redundant except in the case of a view, |
| 964 | // in which case the base relation (and alias) must be specified |
| 965 | |
| 966 | blrOp = csb->csb_blr_reader.getByte(); |
| 967 | |
| 968 | // Don't make RecordSourceNode::parse() to parse the context, because |
| 969 | // this would add a new context, while this is a reference to |
| 970 | // an existing context |
| 971 | |
| 972 | switch (blrOp) |
| 973 | { |
| 974 | case blr_relation: |
| 975 | case blr_rid: |
| 976 | case blr_relation2: |
| 977 | case blr_rid2: |
no test coverage detected