blob: a3339610e06ae61cf7c9a8e974f430710e6c5fe9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
include <tbset.h>
include "tbtables.h"
include "tblerr.h"
# tbzudf -- set to undefined
# "Delete" entries in a table by setting each entry in the internal
# memory for the column to the INDEF value appropriate for its datatype.
# This version is for text tables.
#
# Phil Hodge, 3-Feb-1992 Subroutine created.
procedure tbzudf (tp, cp, numcols, rownum)
pointer tp # i: pointer to table descriptor
pointer cp[numcols] # i: array of pointers to column descriptors
int numcols # i: number of columns
int rownum # i: row number
#--
int k # Loop index
int datatype # Data type of a column
int lenstr # length of a string table element
int ip # offset to a string in Memc
begin
do k = 1, numcols {
datatype = COL_DTYPE(cp[k])
if (datatype == TBL_TY_DOUBLE) {
Memd[COL_OFFSET(cp[k]) + rownum - 1] = INDEFD
} else if (datatype == TBL_TY_INT) {
Memi[COL_OFFSET(cp[k]) + rownum - 1] = INDEFI
} else if (datatype < 0) {
lenstr = -COL_DTYPE(cp[k]) # not including EOS
ip = (rownum - 1) * (lenstr + 1) # including EOS
Memc[COL_OFFSET(cp[k]) + ip] = EOS
} else {
call error (ER_TBCOLBADTYP, "tbzudf: bad datatype")
}
}
end
|