Returns (creating, if necessary) the WindowMap of a given partition (that may be NULL).
| 3015 | |
| 3016 | // Returns (creating, if necessary) the WindowMap of a given partition (that may be NULL). |
| 3017 | WindowMap* dsql_ctx::getWindowMap(DsqlCompilerScratch* dsqlScratch, WindowClause* windowNode) |
| 3018 | { |
| 3019 | thread_db* tdbb = JRD_get_thread_data(); |
| 3020 | MemoryPool& pool = *tdbb->getDefaultPool(); |
| 3021 | |
| 3022 | bool isNullWindow = windowNode == NULL; |
| 3023 | WindowClause nullWindow(pool, NULL, NULL, NULL, NULL, WindowClause::Exclusion::NO_OTHERS); |
| 3024 | |
| 3025 | if (isNullWindow) |
| 3026 | windowNode = &nullWindow; |
| 3027 | |
| 3028 | WindowMap* windowMap = NULL; |
| 3029 | |
| 3030 | for (Array<WindowMap*>::iterator i = ctx_win_maps.begin(); |
| 3031 | !windowMap && i != ctx_win_maps.end(); |
| 3032 | ++i) |
| 3033 | { |
| 3034 | if (PASS1_node_match(dsqlScratch, (*i)->window, windowNode, false)) |
| 3035 | { |
| 3036 | windowMap = *i; |
| 3037 | } |
| 3038 | } |
| 3039 | |
| 3040 | if (!windowMap) |
| 3041 | { |
| 3042 | if (isNullWindow) |
| 3043 | { |
| 3044 | windowNode = FB_NEW_POOL(pool) WindowClause(pool, NULL, NULL, NULL, NULL, |
| 3045 | WindowClause::Exclusion::NO_OTHERS); |
| 3046 | } |
| 3047 | |
| 3048 | windowMap = FB_NEW_POOL(*tdbb->getDefaultPool()) WindowMap(windowNode); |
| 3049 | ctx_win_maps.add(windowMap); |
| 3050 | windowMap->context = dsqlScratch->contextNumber++; |
| 3051 | } |
| 3052 | |
| 3053 | return windowMap; |
| 3054 | } |
no test coverage detected