/ SetBitMap: Calculate the bit map of existing values in one block. */ Note: TYPE_STRING is processed with zero ended strings */ to be matching the way the FILTER Eval function processes them. */ /
| 2815 | /* to be matching the way the FILTER Eval function processes them. */ |
| 2816 | /***********************************************************************/ |
| 2817 | bool DOSCOL::SetBitMap(PGLOBAL g) |
| 2818 | { |
| 2819 | int i, m, n; |
| 2820 | uint *bmp; |
| 2821 | PTDBDOS tp = (PTDBDOS)To_Tdb; |
| 2822 | PDBUSER dup = PlgGetUser(g); |
| 2823 | |
| 2824 | n = tp->Txfp->CurNum; |
| 2825 | bmp = (uint*)Bmap->GetValPtr(Nbm * tp->Txfp->CurBlk); |
| 2826 | |
| 2827 | // Extract column value from current line |
| 2828 | ReadColumn(g); |
| 2829 | |
| 2830 | if (CheckSorted(g)) |
| 2831 | return true; |
| 2832 | |
| 2833 | if (!n) // New block |
| 2834 | for (m = 0; m < Nbm; m++) |
| 2835 | bmp[m] = 0; // Reset the new bit map |
| 2836 | |
| 2837 | if ((i = Dval->Find(Value)) < 0) { |
| 2838 | char buf[32]; |
| 2839 | |
| 2840 | snprintf(g->Message, sizeof(g->Message), MSG(DVAL_NOTIN_LIST), |
| 2841 | Value->GetCharString(buf), Name); |
| 2842 | return true; |
| 2843 | } else if (i >= dup->Maxbmp) { |
| 2844 | snprintf(g->Message, sizeof(g->Message), MSG(OPT_LOGIC_ERR), i); |
| 2845 | return true; |
| 2846 | } else { |
| 2847 | m = i / MAXBMP; |
| 2848 | #if defined(_DEBUG) |
| 2849 | assert (m < Nbm); |
| 2850 | #endif // _DEBUG |
| 2851 | bmp[m] |= (1 << (i % MAXBMP)); |
| 2852 | } // endif's i |
| 2853 | |
| 2854 | return false; |
| 2855 | } // end of SetBitMap |
| 2856 | |
| 2857 | /***********************************************************************/ |
| 2858 | /* Checks whether a column declared as sorted is sorted indeed. */ |
no test coverage detected