4 $include ../regression;
7 static void openit(void);
8 static void dosqlprint(void) {
9 printf("doSQLprint: Error: %s\n", sqlca.sqlerrm.sqlerrmc);
14 $int i = 14, loopcount;
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);
55 for (loopcount = 0; loopcount < 100; loopcount++)
57 $fetch forward c into :i, :j, :c;
58 if (sqlca.sqlcode == 100) break;
60 if (risnull(CDECIMALTYPE, (char *)&j))
61 printf("%d NULL\n", i);
67 printf("%d %d \"%s\"\n", i, a, c);
74 $delete from test where i= :n::decimal;
75 printf("DELETE: %ld\n", sqlca.sqlcode);
77 $select 1 from test where i=14;
78 printf("Exists: %ld\n", sqlca.sqlcode);
80 $select 1 from test where i=147;
81 printf("Does not exist: %ld\n", sqlca.sqlcode);
92 static void openit(void)