summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/test/test1.c
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@hub.org>1998-05-06 13:03:47 +0000
committerMarc G. Fournier <scrappy@hub.org>1998-05-06 13:03:47 +0000
commit6bccf64d7b1defcde643fdb708ec265a93ed5c6b (patch)
treef89bc656b115941e6d8fcbe77cf117d11455d8d7 /src/interfaces/ecpg/test/test1.c
parentf9322c66d3cc06b011c087e6016c461d0e78648e (diff)
From: Michael Meskes <meskes@topsystem.de>
Tue Apr 28 14:48:41 CEST 1998 - Put operator "->" back into parser. Note that :foo->bar means the C term, but :foo ->bar means the operator "->". Tue Apr 28 15:49:07 CEST 1998 - Added exec sql disconnect command. - Allow varchar in C to be written in uppercase too. - Added whenever option "do break;" Wed Apr 29 09:17:53 CEST 1998 - Corrected parsing of C comments. - Also allow C++ style comments. - Make sure not found is only checked after commands that could return it. - Added error codes, see ecpgerror.h for details. - Added "exec sql <TransactionStmt> release" as disconnect statement for compatibility issues. Thu Apr 30 10:42:10 CEST 1998 - Added a -t option to disable automatic transaction start. - Added sqlerrd[] to sqlca struct. - Give back number of tuples affect in sqlca.sqlerrd[2]. Thu Apr 30 13:36:02 CEST 1998 - Make the return code different in case of different errors. Wed May 6 11:42:48 CEST 1998 - Free memory if possible - Some bugfixes for bugs I found while changing the memory allocation code - Now able to fill complete array with one call (see test1.pgc for an example) - Set version to 2.3.0 - Set library version to 2.1
Diffstat (limited to 'src/interfaces/ecpg/test/test1.c')
-rw-r--r--src/interfaces/ecpg/test/test1.c72
1 files changed, 0 insertions, 72 deletions
diff --git a/src/interfaces/ecpg/test/test1.c b/src/interfaces/ecpg/test/test1.c
deleted file mode 100644
index f2533d544d9..00000000000
--- a/src/interfaces/ecpg/test/test1.c
+++ /dev/null
@@ -1,72 +0,0 @@
-exec sql begin declare section;
-VARCHAR uid[200 /* VARSIZE */ ];
-varchar name[200];
-short value;
-exec sql end declare section;
-
-exec sql include sqlca;
-
-#define DBCP(x,y) strcpy(x.arr,y);x.len = strlen(x.arr)
-#define LENFIX(x) x.len=strlen(x.arr)
-#define STRFIX(x) x.arr[x.len]='\0'
-#define SQLCODE sqlca.sqlcode
-
-void
-db_error(char *msg)
-{
- sqlca.sqlerrm.sqlerrmc[sqlca.sqlerrm.sqlerrml] = '\0';
- printf("%s: db error %s\n", msg, sqlca.sqlerrm.sqlerrmc);
- exit(1);
-}
-
-int
-main()
-{
- strcpy(uid.arr, "test/test");
- LENFIX(uid);
-
- exec sql connect 'kom';
-
- if (SQLCODE)
- db_error("connect");
-
- strcpy(name.arr, "opt1");
- LENFIX(name);
-
- exec sql declare cur cursor for
- select name,
- value from pace_test;
-
- if (SQLCODE)
- db_error("declare");
-
- exec sql open cur;
-
- if (SQLCODE)
- db_error("open");
-
- while (1)
- {
- exec sql fetch in cur into:name,
- : value;
-
- if (SQLCODE)
- break;
- STRFIX(name);
- printf("%s\t%d\n", name.arr, value);
- }
-
- if (SQLCODE < 0)
- db_error("fetch");
-
- exec sql close cur;
-
- if (SQLCODE)
- db_error("close");
- exec sql commit;
-
- if (SQLCODE)
- db_error("commit");
-
- return (0);
-}