TLA Line data Source code
1 : #include <stdio.h> 2 : #include <stdlib.h> 3 : #include <string.h> 4 : 5 : EXEC SQL INCLUDE ../regression; 6 : 7 CBC 1 : int main() { 8 : EXEC SQL BEGIN DECLARE SECTION; 9 : char var[25]; 10 : int i, loopcount; 11 : EXEC SQL END DECLARE SECTION; 12 : 13 1 : ECPGdebug(1, stderr); 14 1 : EXEC SQL CONNECT TO REGRESSDB1; 15 : 16 1 : EXEC SQL SET AUTOCOMMIT TO ON; 17 : EXEC SQL WHENEVER SQLWARNING SQLPRINT; 18 : EXEC SQL WHENEVER SQLERROR STOP; 19 : 20 1 : EXEC SQL CREATE TABLE "My_Table" ( Item1 int, Item2 text ); 21 1 : 22 1 : EXEC SQL SET standard_conforming_strings TO off; 23 1 : 24 1 : EXEC SQL SHOW standard_conforming_strings INTO :var; 25 1 : printf("Standard conforming strings: %s\n", var); 26 : 27 : /* this is a\\b actually */ 28 1 : EXEC SQL INSERT INTO "My_Table" VALUES ( 1, 'a\\\\b' ); 29 1 : /* this is a\\b */ 30 1 : EXEC SQL INSERT INTO "My_Table" VALUES ( 1, E'a\\\\b' ); 31 1 : 32 1 : EXEC SQL SET standard_conforming_strings TO on; 33 1 : 34 1 : EXEC SQL SHOW standard_conforming_strings INTO :var; 35 1 : printf("Standard conforming strings: %s\n", var); 36 : 37 : /* this is a\\\\b actually */ 38 1 : EXEC SQL INSERT INTO "My_Table" VALUES ( 2, 'a\\\\b' ); 39 1 : /* this is a\\b */ 40 1 : EXEC SQL INSERT INTO "My_Table" VALUES ( 2, E'a\\\\b' ); 41 1 : 42 1 : EXEC SQL BEGIN; 43 1 : EXEC SQL DECLARE C CURSOR FOR SELECT * FROM "My_Table"; 44 : 45 1 : EXEC SQL OPEN C; 46 1 : 47 : EXEC SQL WHENEVER NOT FOUND DO BREAK; 48 : 49 5 : for (loopcount = 0; loopcount < 100; loopcount++) 50 : { 51 5 : EXEC SQL FETCH C INTO :i, :var; 52 5 : printf("value: %d %s\n", i, var); 53 : } 54 : 55 1 : EXEC SQL ROLLBACK; 56 1 : EXEC SQL DROP TABLE "My_Table"; 57 1 : 58 1 : EXEC SQL DISCONNECT ALL; 59 1 : 60 1 : return 0; 61 : }