]> granicus.if.org Git - postgresql/commitdiff
Changed the way symbols are defined in C in INFORMIX mode.
authorMichael Meskes <meskes@postgresql.org>
Fri, 15 Feb 2008 12:11:02 +0000 (12:11 +0000)
committerMichael Meskes <meskes@postgresql.org>
Fri, 15 Feb 2008 12:11:02 +0000 (12:11 +0000)
Added SQLSTATE macro closing bug #3961.
EXECUTE can return NOT FOUND so it should be checked here too.

src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/include/datetime.h
src/interfaces/ecpg/include/decimal.h
src/interfaces/ecpg/include/ecpg_informix.h
src/interfaces/ecpg/include/ecpglib.h
src/interfaces/ecpg/preproc/pgc.l
src/interfaces/ecpg/preproc/preproc.y

index 846c67cc0c9c4af19f65df459b4ac0ef9cc74b1b..7a2f8346a648928225de68884b6def934ea54643 100644 (file)
@@ -2307,4 +2307,13 @@ Wed, 06 Feb 2008 09:04:48 +0100
        - Fixed segfault in ecpg when using an array element.
        - Free all memory in auto-prepare mode.
 
+Thu, 14 Feb 2008 13:11:34 +0100
+
+       - Added SQLSTATE macro closing bug #3961.
+       - EXECUTE can return NOT FOUND so it should be checked here too.
+       - Changed regression test accordingly.
+
+Fri, 15 Feb 2008 12:01:13 +0100
+
+       - Changed the way symbols are defined in C in INFORMIX mode.
 
index c3a706267555914f1729c31e20f400691cafe6a9..e18aae7b0481cebdbe46cb15f40be2d01321700b 100644 (file)
@@ -1,11 +1,12 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/datetime.h,v 1.12 2006/03/11 04:38:39 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/datetime.h,v 1.12.4.1 2008/02/15 12:11:02 meskes Exp $ */
 
 #ifndef _ECPG_DATETIME_H
 #define _ECPG_DATETIME_H
 
 #include <ecpg_informix.h>
 
-typedef timestamp dtime_t;
-typedef interval intrvl_t;
+/* brought in by ecpg_informix.h nowadays
+ * typedef timestamp dtime_t;
+ * typedef interval intrvl_t; */
 
 #endif   /* ndef _ECPG_DATETIME_H */
index 9944f052e33cbcd6fefea8a8449e2c5ae2bf8394..3bbd6f0357b40b8a3c842c85d96264002829281e 100644 (file)
@@ -1,10 +1,11 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/decimal.h,v 1.14 2006/03/11 04:38:39 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/decimal.h,v 1.14.4.1 2008/02/15 12:11:02 meskes Exp $ */
 
 #ifndef _ECPG_DECIMAL_H
 #define _ECPG_DECIMAL_H
 
 #include <ecpg_informix.h>
 
-typedef decimal dec_t;
+/* brought in by ecpg_informix.h nowadays
+ * typedef decimal dec_t; */
 
 #endif   /* ndef _ECPG_DECIMAL_H */
index 4441c56b335c566f4c77bb13e1a4bdc57b035292..c19fa8d6738b9a560cd6411659f258c685f3ab0b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * This file contains stuff needed to be as compatible to Informix as possible.
- * $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpg_informix.h,v 1.18 2006/03/11 04:38:39 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpg_informix.h,v 1.18.4.1 2008/02/15 12:11:02 meskes Exp $
  */
 #ifndef _ECPG_INFORMIX_H
 #define _ECPG_INFORMIX_H
@@ -82,6 +82,11 @@ extern int   dttofmtasc(timestamp *, char *, int, char *);
 extern int     intoasc(interval *, char *);
 extern int     dtcvfmtasc(char *, char *, timestamp *);
 
+/* we also define Informix datatypes here */
+typedef timestamp dtime_t;
+typedef interval intrvl_t;
+typedef decimal dec_t;
+
 #ifdef __cplusplus
 }
 #endif
index 18cab5029e9efc02d5c07e78a4e597fc971d6831..6034a0901f53396a26a767c04fdbcd85d2c3a99c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * this is a small part of c.h since we don't want to leak all postgres
  * definitions into ecpg programs
- * $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpglib.h,v 1.74 2008/01/13 11:53:16 meskes Exp $
+ * $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpglib.h,v 1.74.2.1 2008/02/15 12:11:02 meskes Exp $
  */
 
 #ifndef _ECPGLIB_H
@@ -58,7 +58,8 @@ void          sqlprint(void);
 
 /* define this for simplicity as well as compatibility */
 
-#define                  SQLCODE        sqlca.sqlcode
+#define                SQLCODE         sqlca.sqlcode
+#define                SQLSTATE        sqlca.sqlstate
 
 /* dynamic SQL */
 
index e5bd28be920a05f118cea85aa50529fc59569ae6..ee2805d157f3f60440d7cf01d6a5388ff16efc41 100644 (file)
@@ -12,7 +12,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.159 2008/01/15 10:31:47 meskes Exp $
+ *       $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.159.2.1 2008/02/15 12:11:02 meskes Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -47,7 +47,6 @@ static void addlitchar (unsigned char);
 static void parse_include (void);
 static bool ecpg_isspace(char ch);
 static bool isdefine(void);
-static bool isinformixdefine(void);
 
 char *token_start;
 int state_before;
@@ -744,9 +743,11 @@ cppline                    {space}*#(.*\\{space})*.*{newline}
 <C>{identifier}        {
                                                const ScanKeyword               *keyword;
                                                        
-                                               /* Informix uses SQL defines only in SQL space */
-                                               /* however, some defines have to be taken care of for compatibility */
-                                               if ((!INFORMIX_MODE || !isinformixdefine()) && !isdefine())
+<<<<<<< pgc.l
+                                               if (!INFORMIX_MODE && !isdefine())
+=======
+                                               if (!isdefine())
+>>>>>>> 1.162
                                                {
                                                        keyword = ScanCKeywordLookup(yytext);
                                                        if (keyword != NULL)
@@ -1318,36 +1319,6 @@ static bool isdefine(void)
        return false;
 }
 
-static bool isinformixdefine(void)
-{
-       const char *new = NULL;
-
-       if (strcmp(yytext, "dec_t") == 0)
-               new = "decimal";
-       else if (strcmp(yytext, "intrvl_t") == 0)
-               new = "interval";
-       else if (strcmp(yytext, "dtime_t") == 0)
-                new = "timestamp";
-
-       if (new)
-       {
-               struct _yy_buffer *yb;
-
-               yb = mm_alloc(sizeof(struct _yy_buffer));
-
-               yb->buffer =  YY_CURRENT_BUFFER;
-               yb->lineno = yylineno;
-               yb->filename = mm_strdup(input_filename);
-               yb->next = yy_buffer;
-               yy_buffer = yb;
-
-               yy_scan_string(new);
-               return true;
-       }
-
-       return false;
-}
-
 /*
  * Called before any actual parsing is done
  */
index 9bcf99448031bdfc37c098a98403f05688fda462..5b7cef224c41a7c1c22f3eb8fc57c3f882edb5d6 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.359 2008/01/15 10:31:47 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.359.2.1 2008/02/15 12:11:02 meskes Exp $ */
 
 /* Copyright comment */
 %{
@@ -807,7 +807,7 @@ stmt:  AlterDatabaseStmt            { output_statement($1, 0, ECPGst_normal); }
                | DropUserStmt          { output_statement($1, 0, ECPGst_normal); }
                | DropdbStmt            { output_statement($1, 0, ECPGst_normal); }
                | ExplainStmt           { output_statement($1, 0, ECPGst_normal); }
-               | ExecuteStmt           { output_statement($1, 0, ECPGst_execute); }
+               | ExecuteStmt           { output_statement($1, 1, ECPGst_execute); }
                | FetchStmt             { output_statement($1, 1, ECPGst_normal); }
                | GrantStmt             { output_statement($1, 0, ECPGst_normal); }
                | GrantRoleStmt         { output_statement($1, 0, ECPGst_normal); }