Project

General

Profile

collation-test.p

single-byte collation in p4gl - Ovidiu Maxiniuc, 06/13/2014 02:19 PM

Download (1.03 KB)

 
1
output to collation-test.txt .
2

    
3
function d returns logical (input s as character) :
4
    display s format "x(50)"
5
            skip with frame fx no-box no-labels.
6
end function.
7

    
8

    
9
d("Table definition ...").
10
define temp-table ttx
11
    field ix as integer
12
    field cx as character
13
    field dx as character case-sensitive
14
    index id-cx cx
15
    index id-dx dx.
16

    
17
d("Populate table with test data ...").
18
define variable i as integer.
19
do i = 0 to 256:
20
    create ttx.
21
    ttx.ix = i.
22
    ttx.cx = "a" + chr(i) + "z".
23
    ttx.dx = "b" + chr(i) + "y".
24
end.
25

    
26

    
27
d("Run query ascending case-insensitive query").
28
for each ttx by cx:
29
    d(string(ix, ">>9") + ")" + cx).
30
end.
31

    
32
d("Run query ascending case-sensitive query").
33
for each ttx by dx:
34
    d(string(ix, ">>9") + ")" + dx).
35
end.
36

    
37
/*    
38
d("Run query descending case-insensitive query"). 
39
for each ttx by cx desc:
40
    d(string(ix, ">>9") + ")" + cx).
41
end.
42

    
43
d("Run query descending case-sensitive query").
44
for each ttx by dx desc:
45
    d(string(ix, ">>9") + ")" + dx).
46
end.
47
*/
48

    
49
output close.
50
message "all done".
51