From a7b1ff6619413398d7e69b0888b6672d6b9413a6 Mon Sep 17 00:00:00 2001 From: Michael Meskes Date: Wed, 5 Apr 2000 15:51:28 +0000 Subject: [PATCH] *** empty log message *** --- src/interfaces/ecpg/ChangeLog | 4 ++++ src/interfaces/ecpg/lib/execute.c | 4 ++-- src/interfaces/ecpg/test/test4.pgc | 15 ++++++++------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog index be83084ee4..2cc1d4b878 100644 --- a/src/interfaces/ecpg/ChangeLog +++ b/src/interfaces/ecpg/ChangeLog @@ -902,5 +902,9 @@ Wed Apr 5 07:54:56 CEST 2000 - Removed duplicate ',' in execute.c. - Changed error message for backend errors so it fits into sqlca. - Fixed array handling. + +Wed Apr 5 17:35:53 CEST 2000 + + - Fixed handling of bool variables. - Set library version to 3.1.0. - Set ecpg version to 2.7.0. diff --git a/src/interfaces/ecpg/lib/execute.c b/src/interfaces/ecpg/lib/execute.c index 89d756787e..f8910aa7e8 100644 --- a/src/interfaces/ecpg/lib/execute.c +++ b/src/interfaces/ecpg/lib/execute.c @@ -479,7 +479,7 @@ ECPGexecute(struct statement * stmt) strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'")); } else - sprintf(mallocedval, "%c", (*((char *) var->value)) ? 't' : 'f'); + sprintf(mallocedval, "'%c'", (*((char *) var->value)) ? 't' : 'f'); tobeinserted = mallocedval; break; @@ -859,7 +859,7 @@ ECPGdo(int lineno, const char *connection_name, char *query, ...) * * Copyright (c) 2000, Christof Petig * - * $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.4 2000/04/05 09:05:28 meskes Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.5 2000/04/05 15:51:25 meskes Exp $ */ PGconn *ECPG_internal_get_connection(char *name); diff --git a/src/interfaces/ecpg/test/test4.pgc b/src/interfaces/ecpg/test/test4.pgc index 10312b6944..0ac00008e4 100644 --- a/src/interfaces/ecpg/test/test4.pgc +++ b/src/interfaces/ecpg/test/test4.pgc @@ -14,6 +14,7 @@ EXEC SQL BEGIN DECLARE SECTION; char text[10] = "klmnopqrst"; char *t = "uvwxyz1234"; double f; + bool b = true; EXEC SQL END DECLARE SECTION; FILE *dbgs; @@ -28,24 +29,24 @@ EXEC SQL END DECLARE SECTION; EXEC SQL BEGIN WORK; - EXEC SQL CREATE TABLE test (f float, i int, a int[10], text char(10)); + EXEC SQL CREATE TABLE test (f float, i int, a int[10], text char(10), b bool); - EXEC SQL INSERT INTO test(f,i,a,text) VALUES(404.90,1,'{0,1,2,3,4,5,6,7,8,9}','abcdefghij'); + EXEC SQL INSERT INTO test(f,i,a,text,b) VALUES(404.90,1,'{0,1,2,3,4,5,6,7,8,9}','abcdefghij', 'f'); - EXEC SQL INSERT INTO test(f,i,a,text) VALUES(140787.0,2,:a,:text); + EXEC SQL INSERT INTO test(f,i,a,text,b) VALUES(140787.0,2,:a,:text,'t'); - EXEC SQL INSERT INTO test(f,i,a,text) VALUES(14.07,:did,:a,:t); + EXEC SQL INSERT INTO test(f,i,a,text,b) VALUES(14.07,:did,:a,:t,:b); EXEC SQL COMMIT; EXEC SQL BEGIN WORK; - EXEC SQL SELECT f,text - INTO :f,:text + EXEC SQL SELECT f,text,b + INTO :f,:text,:b FROM test WHERE i = 1; - printf("Found f=%f text=%10.10s\n", f, text); + printf("Found f=%f text=%10.10s b=%d\n", f, text, b); f=14.07; EXEC SQL SELECT a,text