OSDN Git Service

*** empty log message ***
authorMichael Meskes <meskes@postgresql.org>
Wed, 5 Apr 2000 15:51:28 +0000 (15:51 +0000)
committerMichael Meskes <meskes@postgresql.org>
Wed, 5 Apr 2000 15:51:28 +0000 (15:51 +0000)
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/lib/execute.c
src/interfaces/ecpg/test/test4.pgc

index be83084..2cc1d4b 100644 (file)
@@ -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.
index 89d7567..f8910aa 100644 (file)
@@ -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 <christof.petig@wtal.de>
  *
- * $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);
index 10312b6..0ac0000 100644 (file)
@@ -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