Project

General

Profile

find-index-limitation.p

testcase for permanent table - Ovidiu Maxiniuc, 04/03/2014 03:26 PM

Download (1.94 KB)

 
1
/* initial cleanup */
2
for each novel:
3
    delete novel.
4
end.
5

    
6
/* populating a record so that the length of teh field are exponentially bigger */
7
create novel.
8
chapter1 = "0123456789 234567890 234567890".
9
chapter2 = chapter1 + chapter1.
10
chapter3 = chapter2 + chapter2.
11
chapter4 = chapter3 + chapter3.
12
chapter5 = chapter4 + chapter4.
13
chapter6 = chapter5 + chapter5.
14
chapter7 = chapter1 + chapter2 + chapter3 + chapter4 + chapter5 + chapter6.
15

    
16
/* 1890 bytes in both indexes */
17
display "current index size : "
18
    length(chapter1) + length(chapter2) + length(chapter3) +
19
        length(chapter4) + length(chapter5) + length(chapter6)
20
    length(chapter7) skip.
21
            
22

    
23
define variable tmp as char no-undo.
24
tmp = chapter1.
25

    
26
/* increase the length of the smaller field until error occurs */
27
repeat while true on error undo, leave:
28
    /* print out the expected index size for the record */
29
    display tmp 
30
            length(tmp) + length(chapter2) + length(chapter3) + 
31
                length(chapter4) + length(chapter5) + length(chapter6).
32
    tmp = tmp + "x".
33
    
34
    /* compute the max for composed (chapter1..6) index */
35
    assign chapter1 = tmp no-error.
36

    
37
    IF ERROR-STATUS:ERROR OR ERROR-STATUS:NUM-MESSAGES > 0 THEN DO:
38
        Display ERROR-STATUS:NUM-MESSAGES + 0.
39
        leave.
40
    ENd.
41
end.
42
display tmp length(tmp) skip.
43

    
44
tmp = chapter7.
45
repeat while true  on error undo, leave:
46
    /* print out the expected index size for the record */
47
    display tmp length(tmp).
48
    tmp = tmp + "x".
49
    
50
    /* compute the max for composed (chapter1..6) index */
51
    assign chapter7 = tmp no-error.
52
        
53
    IF ERROR-STATUS:ERROR OR ERROR-STATUS:NUM-MESSAGES > 0 THEN DO:
54
        Display ERROR-STATUS:NUM-MESSAGES + 0.
55
        leave.
56
    ENd.
57
end.
58

    
59
display "maximum index size : "
60
    length(chapter1) + length(chapter2) + length(chapter3) +
61
    length(chapter4) + length(chapter5) + length(chapter6) label "compose index"
62
    length(chapter7) label "single-field index" skip.
63