summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/test/test2.pgc
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/test2.pgc
parentf9322c66d3cc06b011c087e6016c461d0e78648e (diff)
downloadpostgresql-6bccf64d7b1defcde643fdb708ec265a93ed5c6b.tar.gz
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/test2.pgc')
-rw-r--r--src/interfaces/ecpg/test/test2.pgc20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/interfaces/ecpg/test/test2.pgc b/src/interfaces/ecpg/test/test2.pgc
index 87834aaa6b..ed0599cdea 100644
--- a/src/interfaces/ecpg/test/test2.pgc
+++ b/src/interfaces/ecpg/test/test2.pgc
@@ -2,13 +2,6 @@
exec sql include header_test;
-static int not_found = 0;
-static void
-set_not_found(void)
-{
- not_found = 1;
-}
-
int
main ()
{
@@ -43,10 +36,7 @@ exec sql end declare section;
exec sql insert into meskes(name, born, age, married) values ('Michael', 19660117, 32, '19900404');
exec sql insert into meskes(name, born, age) values ('Carsten', 19910103, 7);
exec sql insert into meskes(name, born, age) values ('Marc', 19930907, 4);
-
- sprintf(command, "insert into meskes(name, born, age) values ('Chris', 19970923, 0)");
- strcpy(msg, "execute");
- exec sql execute immediate :command;
+ exec sql insert into meskes(name, born, age) values ('Chris', 19970923, 0);
strcpy(msg, "commit");
exec sql commit;
@@ -58,11 +48,10 @@ exec sql end declare section;
strcpy(msg, "open");
exec sql open cur;
- while (not_found == 0) {
+ while (1) {
strcpy(msg, "fetch");
exec sql fetch cur into :personal:ind_personal, :married:ind_married;
- if (not_found == 0)
- printf ("%8.8s was born %d (age = %d) %s%s\n", personal.name.arr, personal.birth.born, personal.birth.age, ind_married ? "" : "and married ", ind_married ? "" : married);
+ printf ("%8.8s was born %d (age = %d) %s%s\n", personal.name.arr, personal.birth.born, personal.birth.age, ind_married ? "" : "and married ", ind_married ? "" : married);
}
strcpy(msg, "close");
@@ -74,6 +63,9 @@ exec sql end declare section;
strcpy(msg, "commit");
exec sql commit;
+ strcpy(msg, "disconnect");
+
+ exec sql disconnect;
if (dbgs != NULL)
fclose(dbgs);