Post an item to a map for a context.
| 2886 | |
| 2887 | // Post an item to a map for a context. |
| 2888 | DsqlMapNode* PASS1_post_map(DsqlCompilerScratch* dsqlScratch, ValueExprNode* node, |
| 2889 | dsql_ctx* context, WindowClause* windowNode) |
| 2890 | { |
| 2891 | DEV_BLKCHK(node, dsql_type_nod); |
| 2892 | DEV_BLKCHK(context, dsql_type_ctx); |
| 2893 | |
| 2894 | thread_db* tdbb = JRD_get_thread_data(); |
| 2895 | |
| 2896 | WindowMap* windowMap = NULL; |
| 2897 | dsql_map* map = NULL; |
| 2898 | |
| 2899 | if (dsqlScratch->processingWindow) |
| 2900 | { |
| 2901 | windowMap = context->getWindowMap(dsqlScratch, windowNode); |
| 2902 | map = windowMap->map; |
| 2903 | } |
| 2904 | else |
| 2905 | map = context->ctx_map; |
| 2906 | |
| 2907 | USHORT count = 0; |
| 2908 | |
| 2909 | while (map) |
| 2910 | { |
| 2911 | if (PASS1_node_match(dsqlScratch, node, map->map_node, false)) |
| 2912 | break; |
| 2913 | |
| 2914 | ++count; |
| 2915 | map = map->map_next; |
| 2916 | } |
| 2917 | |
| 2918 | if (!map) |
| 2919 | { |
| 2920 | dsql_map** next = windowMap ? &windowMap->map : &context->ctx_map; |
| 2921 | |
| 2922 | if (*next) |
| 2923 | { |
| 2924 | while (*(next = &(*next)->map_next)) |
| 2925 | ; |
| 2926 | } |
| 2927 | |
| 2928 | map = *next = FB_NEW_POOL(*tdbb->getDefaultPool()) dsql_map; |
| 2929 | map->map_position = count; |
| 2930 | map->map_node = node; |
| 2931 | map->map_window = windowMap; |
| 2932 | } |
| 2933 | |
| 2934 | DsqlDescMaker::fromNode(dsqlScratch, node); |
| 2935 | |
| 2936 | return FB_NEW_POOL(*tdbb->getDefaultPool()) DsqlMapNode(*tdbb->getDefaultPool(), context, map); |
| 2937 | } |
| 2938 | |
| 2939 | |
| 2940 | // For each relation in the list, flag the relation's context as having a parent context. |
no test coverage detected