4
$include ../regression;
8
test_null(int type, char *ptr)
10
printf("null: %d\n", risnull(type, ptr));
21
$double dbl = 404.404;
27
$whenever sqlerror do sqlprint();
29
$connect to REGRESSDB1;
31
$create table test(id int, c char(10), s smallint, i int, b bool,
32
f float, l bigint, dbl double precision,
33
dec decimal, dat date, tmp timestamptz);
36
$insert into test (id, c, s, i, b, f, l, dbl) values (
37
1, :c, :s, :i, :b, :f, :l, :dbl
41
rsetnull(CCHARTYPE, (char *) c);
42
rsetnull(CSHORTTYPE, (char *) &s);
43
rsetnull(CINTTYPE, (char *) &i);
44
rsetnull(CBOOLTYPE, (char *) &b);
45
rsetnull(CFLOATTYPE, (char *) &f);
46
rsetnull(CLONGTYPE, (char *) &l);
47
rsetnull(CDOUBLETYPE, (char *) &dbl);
48
rsetnull(CDECIMALTYPE, (char *) &dec);
49
rsetnull(CDATETYPE, (char *) &dat);
50
rsetnull(CDTIMETYPE, (char *) &tmp);
52
$insert into test (id, c, s, i, b, f, l, dbl, dec, dat, tmp) values (
53
2, :c, :s, :i, :b, :f, :l, :dbl, :dec, :dat, :tmp
57
printf("first select\n");
59
$select c, s, i, b, f, l, dbl, dec, dat, tmp
60
into :c, :s, :i, :b, :f, :l, :dbl, :dec, :dat, :tmp
61
from test where id = 1;
63
test_null(CCHARTYPE, (char *) c);
64
test_null(CSHORTTYPE, (char *) &s);
65
test_null(CINTTYPE, (char *) &i);
66
test_null(CBOOLTYPE, (char *) &b);
67
test_null(CFLOATTYPE, (char *) &f);
68
test_null(CLONGTYPE, (char *) &l);
69
test_null(CDOUBLETYPE, (char *) &dbl);
70
test_null(CDECIMALTYPE, (char *) &dec);
71
test_null(CDATETYPE, (char *) &dat);
72
test_null(CDTIMETYPE, (char *) &tmp);
74
printf("second select\n");
76
$select c, s, i, b, f, l, dbl, dec, dat, tmp
77
into :c, :s, :i, :b, :f, :l, :dbl, :dec, :dat, :tmp
78
from test where id = 2;
80
test_null(CCHARTYPE, (char *) c);
81
test_null(CSHORTTYPE, (char *) &s);
82
test_null(CINTTYPE, (char *) &i);
83
test_null(CBOOLTYPE, (char *) &b);
84
test_null(CFLOATTYPE, (char *) &f);
85
test_null(CLONGTYPE, (char *) &l);
86
test_null(CDOUBLETYPE, (char *) &dbl);
87
test_null(CDECIMALTYPE, (char *) &dec);
88
test_null(CDATETYPE, (char *) &dat);
89
test_null(CDTIMETYPE, (char *) &tmp);