4
$include ../regression;
7
static void openit(void);
8
static void dosqlprint(void) {
9
printf("doSQLprint: Error: %s\n", sqlca.sqlerrm.sqlerrmc);
19
$whenever sqlerror do dosqlprint();
21
$connect to REGRESSDB1;
22
if (sqlca.sqlcode != 0) exit(1);
24
$create table test(i int primary key, j int, c text);
26
/* this INSERT works */
27
rsetnull(CDECIMALTYPE, (char *)&j);
28
$insert into test (i, j, c) values (7, :j, 'test ');
31
/* this INSERT should fail because i is a unique column */
32
$insert into test (i, j, c) values (7, NUMBER, 'a');
33
printf("INSERT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
34
if (sqlca.sqlcode != 0) $rollback;
36
$insert into test (i, j, c) values (:i, 1, 'a ');
39
/* this will fail (more than one row in subquery) */
40
$select i from test where j=(select j from test);
43
/* this however should be ok */
44
$select i from test where j=(select j from test order by i limit 1);
45
printf("SELECT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
46
if (sqlca.sqlcode != 0) $rollback;
49
$declare c cursor for select * from test where i <= :i;
50
printf ("%ld\n", sqlca.sqlcode);
57
$fetch forward c into :i, :j, :c;
58
if (sqlca.sqlcode == 100) break;
59
else if (sqlca.sqlcode != 0) printf ("Error: %ld\n", sqlca.sqlcode);
61
if (risnull(CDECIMALTYPE, (char *)&j))
62
printf("%d NULL\n", i);
68
printf("%d %d \"%s\"\n", i, a, c);
75
$delete from test where i= :n::decimal;
76
printf("DELETE: %ld\n", sqlca.sqlcode);
78
$select 1 from test where i=14;
79
printf("Exists: %ld\n", sqlca.sqlcode);
81
$select 1 from test where i=147;
82
printf("Does not exist: %ld\n", sqlca.sqlcode);
93
static void openit(void)