]> granicus.if.org Git - postgresql/commitdiff
- Synced parser and keyword file.
authorMichael Meskes <meskes@postgresql.org>
Fri, 14 Feb 2003 13:17:13 +0000 (13:17 +0000)
committerMichael Meskes <meskes@postgresql.org>
Fri, 14 Feb 2003 13:17:13 +0000 (13:17 +0000)
- More work on Informix compatibility.

src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/include/ecpg_informix.h [new file with mode: 0644]
src/interfaces/ecpg/lib/error.c
src/interfaces/ecpg/lib/extern.h
src/interfaces/ecpg/preproc/Makefile
src/interfaces/ecpg/preproc/ecpg.c
src/interfaces/ecpg/preproc/keywords.c
src/interfaces/ecpg/preproc/pgc.l
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/test/test2.pgc

index a7831fb3b10134c57cdc447f26facd7d1a854396..72eacfa98dd59e86859dfa53ab4aec94e4bd4fdc 100644 (file)
@@ -1332,5 +1332,12 @@ Thu Feb 13 14:06:28 CET 2003
        - Started working on an Informix compatibility mode. With option "-C
          INFORMIX" set, ecpg now accepts "$" as alias for "exec sql" and to
          denote variables inside SQL statements.
        - Started working on an Informix compatibility mode. With option "-C
          INFORMIX" set, ecpg now accepts "$" as alias for "exec sql" and to
          denote variables inside SQL statements.
+
+
+Fri Feb 14 14:14:25 CET 2003
+
+       - Synced parser and keyword file.
+       - More work on Informix compatibility. 
        - Set ecpg version to 2.12.0.
        - Set ecpg version to 2.12.0.
+       - Set library to 3.4.2.
 
 
diff --git a/src/interfaces/ecpg/include/ecpg_informix.h b/src/interfaces/ecpg/include/ecpg_informix.h
new file mode 100644 (file)
index 0000000..a50275d
--- /dev/null
@@ -0,0 +1,6 @@
+/* 
+ * This file contains stuff needed to be as compatible to Informix as possible.
+ */
+
+#define SQLNOTFOUND 100
+
index fc34377f94c45d3f8253e9a35770e9a23de25c14..ba174baaa12ac26fc263c834e12dbd4fca92e36e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/error.c,v 1.18 2003/02/13 18:13:22 tgl Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/error.c,v 1.19 2003/02/14 13:17:13 meskes Exp $ */
 
 #include "postgres_fe.h"
 
 
 #include "postgres_fe.h"
 
@@ -14,7 +14,6 @@
  * the last back-end operation. */
 static char *ECPGerr;
 
  * the last back-end operation. */
 static char *ECPGerr;
 
-
 void
 ECPGraise(int line, int code, const char *str)
 {
 void
 ECPGraise(int line, int code, const char *str)
 {
index a950559e16fdb5aef949b90a25006155142ff1fe..1bd67356be1cb86b7d65a56c1b94635173761d0f 100644 (file)
@@ -6,6 +6,9 @@
 
 /* Here are some methods used by the lib. */
 
 
 /* Here are some methods used by the lib. */
 
+/* Stores the backend error message for client access */
+void set_backend_err(const char *err, int lineon);
+
 /* Store and retrieve the backend error message for client access */
 void set_backend_err(const char *err, int lineon);
 char *ECPGerrmsg(void);
 /* Store and retrieve the backend error message for client access */
 void set_backend_err(const char *err, int lineon);
 char *ECPGerrmsg(void);
index 836f84dd4a5e689f47980caab0077628ef563921..6936d21f33987f5b8f732941790f664af6e2db7d 100644 (file)
@@ -1,11 +1,11 @@
-# $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.89 2002/12/04 18:14:11 momjian Exp $
+# $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.90 2003/02/14 13:17:13 meskes Exp $
 
 subdir = src/interfaces/ecpg/preproc
 top_builddir = ../../../..
 include $(top_builddir)/src/Makefile.global
 
 MAJOR_VERSION=2
 
 subdir = src/interfaces/ecpg/preproc
 top_builddir = ../../../..
 include $(top_builddir)/src/Makefile.global
 
 MAJOR_VERSION=2
-MINOR_VERSION=11
+MINOR_VERSION=12
 PATCHLEVEL=0
 
 override CPPFLAGS := -I$(srcdir)/../include -I$(srcdir) $(CPPFLAGS) \
 PATCHLEVEL=0
 
 override CPPFLAGS := -I$(srcdir)/../include -I$(srcdir) $(CPPFLAGS) \
index d09c6d147444c7f22961e7e0d9b8cbe1e6ded71d..567abfa159005c67faa1759e4c6182be9bc35cf7 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.59 2003/02/13 13:11:52 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.60 2003/02/14 13:17:13 meskes Exp $ */
 
 /* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
 /* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
 
 /* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
 /* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
@@ -315,6 +315,10 @@ main(int argc, char *const argv[])
                                /* we need several includes */
                                fprintf(yyout, "/* Processed by ecpg (%d.%d.%d) */\n/* These four include files are added by the preprocessor */\n#include <ecpgtype.h>\n#include <ecpglib.h>\n#include <ecpgerrno.h>\n#include <sqlca.h>\n#line 1 \"%s\"\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL, input_filename);
 
                                /* we need several includes */
                                fprintf(yyout, "/* Processed by ecpg (%d.%d.%d) */\n/* These four include files are added by the preprocessor */\n#include <ecpgtype.h>\n#include <ecpglib.h>\n#include <ecpgerrno.h>\n#include <sqlca.h>\n#line 1 \"%s\"\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL, input_filename);
 
+                               /* add some compatibility headers */
+                               if (compat == ECPG_COMPAT_INFORMIX)
+                                       fprintf(yyout, "/* Needed for informix compatibility */\n#include <ecpg_informix.h>\n");
+
                                /* and parse the source */
                                yyparse();
 
                                /* and parse the source */
                                yyparse();
 
index e17af9298e250f4d42b8bd0fd3767527d32faca9..b294ac229087cc210e3600b27aa96a14b375d8fe 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.55 2002/10/21 13:09:31 meskes Exp $
+ *       $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.56 2003/02/14 13:17:13 meskes Exp $
  *
  *-------------------------------------------------------------------------
  */
  *
  *-------------------------------------------------------------------------
  */
@@ -28,7 +28,7 @@
  */
 static ScanKeyword ScanKeywords[] = {
        /* name, value */
  */
 static ScanKeyword ScanKeywords[] = {
        /* name, value */
-       {"abort", ABORT_TRANS},
+       {"abort", ABORT_P},
        {"absolute", ABSOLUTE},
        {"access", ACCESS},
        {"action", ACTION},
        {"absolute", ABSOLUTE},
        {"access", ACCESS},
        {"action", ACTION},
@@ -49,7 +49,7 @@ static ScanKeyword ScanKeywords[] = {
        {"authorization", AUTHORIZATION},
        {"backward", BACKWARD},
        {"before", BEFORE},
        {"authorization", AUTHORIZATION},
        {"backward", BACKWARD},
        {"before", BEFORE},
-       {"begin", BEGIN_TRANS},
+       {"begin", BEGIN_P},
        {"between", BETWEEN},
        {"bigint", BIGINT},
        {"binary", BINARY},
        {"between", BETWEEN},
        {"bigint", BIGINT},
        {"binary", BINARY},
@@ -115,7 +115,7 @@ static ScanKeyword ScanKeywords[] = {
        {"else", ELSE},
        {"encoding", ENCODING},
        {"encrypted", ENCRYPTED},
        {"else", ELSE},
        {"encoding", ENCODING},
        {"encrypted", ENCRYPTED},
-       {"end", END_TRANS},
+       {"end", END_P},
        {"escape", ESCAPE},
        {"except", EXCEPT},
        {"exclusive", EXCLUSIVE},
        {"escape", ESCAPE},
        {"except", EXCEPT},
        {"exclusive", EXCLUSIVE},
@@ -226,6 +226,7 @@ static ScanKeyword ScanKeywords[] = {
        {"position", POSITION},
        {"precision", PRECISION},
        {"prepare", PREPARE},
        {"position", POSITION},
        {"precision", PRECISION},
        {"prepare", PREPARE},
+       {"preserve", PRESERVE},
        {"primary", PRIMARY},
        {"prior", PRIOR},
        {"privileges", PRIVILEGES},
        {"primary", PRIMARY},
        {"prior", PRIOR},
        {"privileges", PRIVILEGES},
@@ -246,6 +247,7 @@ static ScanKeyword ScanKeywords[] = {
        {"right", RIGHT},
        {"rollback", ROLLBACK},
        {"row", ROW},
        {"right", RIGHT},
        {"rollback", ROLLBACK},
        {"row", ROW},
+       {"rows", ROWS},
        {"rule", RULE},
        {"schema", SCHEMA},
        {"scroll", SCROLL},
        {"rule", RULE},
        {"schema", SCHEMA},
        {"scroll", SCROLL},
index 44e22f5cc0045f5d258a1604c4227fd3cc172413..a89ef3b1a025660b656a8c62789ccd67d289275d 100644 (file)
@@ -12,7 +12,7 @@
  *
  *
  * IDENTIFICATION
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.103 2003/02/13 20:37:28 meskes Exp $
+ *       $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.104 2003/02/14 13:17:13 meskes Exp $
  *
  *-------------------------------------------------------------------------
  */
  *
  *-------------------------------------------------------------------------
  */
@@ -423,7 +423,6 @@ cppline                     {space}*#(.*\\{space})*.*
                          /* are we simulating Informix? */
                           if (compat == ECPG_COMPAT_INFORMIX)
                          {
                          /* are we simulating Informix? */
                           if (compat == ECPG_COMPAT_INFORMIX)
                          {
-                               printf ("unput $\n");
                                unput(':');
                          }
                          else
                                unput(':');
                          }
                          else
@@ -560,6 +559,12 @@ cppline                    {space}*#(.*\\{space})*.*
                                                if (keyword != NULL)
                                                        return keyword->value;
 
                                                if (keyword != NULL)
                                                        return keyword->value;
 
+                                               /* Is it a C keyword? */
+                                               keyword = ScanCKeywordLookup(yytext);
+                                               if (keyword != NULL)
+                                                       return keyword->value;
+
+
                                                /* How about a DEFINE? */
                                                for (ptr = defines; ptr; ptr = ptr->next)
                                                {
                                                /* How about a DEFINE? */
                                                for (ptr = defines; ptr; ptr = ptr->next)
                                                {
@@ -697,6 +702,7 @@ cppline                     {space}*#(.*\\{space})*.*
 
 <C>{exec_sql}{define}{space}*  { BEGIN(def_ident); }
 <C>{exec_sql}{include}{space}* { BEGIN(incl); }
 
 <C>{exec_sql}{define}{space}*  { BEGIN(def_ident); }
 <C>{exec_sql}{include}{space}* { BEGIN(incl); }
+<C>{informix_special}{include}{space}* { BEGIN(incl); }
 
 <C,xskip>{exec_sql}{ifdef}{space}*     { ifcond = TRUE; BEGIN(xcond); }
 <C,xskip>{exec_sql}{ifndef}{space}* { ifcond = FALSE; BEGIN(xcond); }
 
 <C,xskip>{exec_sql}{ifdef}{space}*     { ifcond = TRUE; BEGIN(xcond); }
 <C,xskip>{exec_sql}{ifndef}{space}* { ifcond = FALSE; BEGIN(xcond); }
@@ -832,32 +838,45 @@ cppline                   {space}*#(.*\\{space})*.*
                                                        i-- )
                                                        {}
 
                                                        i-- )
                                                        {}
 
-                                               /* Remove trailing '"' if it exists */
-                                               if (yytext[i] == '"') 
-                                                       yytext[i] = '\0';
-                                               else
-                                                       yytext[i+1] = '\0';
+                                               yytext[i+1] = '\0';
+                                               yyin = NULL;
 
 
-                                               /* also remove starting '"' */
-                                               if (yytext[0] == '"')
+                                               /* If file name is enclosed in '"' remove these and look only in '.' */
+                                               if (yytext[0] == '"' && yytext[i] == '"') 
+                                               {
+                                                       yytext[i] = '\0';
                                                        memmove(yytext, yytext+1, strlen(yytext));
                                                        memmove(yytext, yytext+1, strlen(yytext));
-
-                                               yyin = NULL;
-                                               for (ip = include_paths; yyin == NULL && ip != NULL; ip = ip->next)
-                                               {
-                                                       if (strlen(ip->path) + strlen(yytext) + 3 > MAXPGPATH)
-                                                       {
-                                                               fprintf(stderr, "Error: Path %s/%s is too long in line %d, skipping.\n", ip->path, yytext, yylineno);
-                                                               continue;
-                                                       }
-                                                       snprintf (inc_file, sizeof(inc_file), "%s/%s", ip->path, yytext);
-                                                       yyin = fopen( inc_file, "r" );
+                                               
+                                                       strncpy(inc_file, yytext, sizeof(inc_file));
+                                                       yyin = fopen(inc_file, "r");
                                                        if (!yyin)
                                                        {
                                                                if (strcmp(inc_file + strlen(inc_file) - 2, ".h"))
                                                                {
                                                                        strcat(inc_file, ".h");
                                                        if (!yyin)
                                                        {
                                                                if (strcmp(inc_file + strlen(inc_file) - 2, ".h"))
                                                                {
                                                                        strcat(inc_file, ".h");
-                                                                       yyin = fopen( inc_file, "r" );
+                                                                       yyin = fopen(inc_file, "r");
+                                                               }
+                                                       }
+                                                       
+                                               }
+                                               else
+                                               {
+                                                       for (ip = include_paths; yyin == NULL && ip != NULL; ip = ip->next)
+                                                       {
+                                                               if (strlen(ip->path) + strlen(yytext) + 3 > MAXPGPATH)
+                                                               {
+                                                                       fprintf(stderr, "Error: Path %s/%s is too long in line %d, skipping.\n", ip->path, yytext, yylineno);
+                                                                       continue;
+                                                               }
+                                                               snprintf (inc_file, sizeof(inc_file), "%s/%s", ip->path, yytext);
+                                                               yyin = fopen(inc_file, "r");
+                                                               if (!yyin)
+                                                               {
+                                                                       if (strcmp(inc_file + strlen(inc_file) - 2, ".h"))
+                                                                       {
+                                                                               strcat(inc_file, ".h");
+                                                                               yyin = fopen( inc_file, "r" );
+                                                                       }
                                                                }
                                                        }
                                                }
                                                                }
                                                        }
                                                }
index 3d407f1cac6a703a35a25f2b218a6be6cdcd48c4..a8770f9e6cafdddb2cd78bb8b0e8ea68947d42a7 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.207 2003/02/13 20:37:28 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.208 2003/02/14 13:17:13 meskes Exp $ */
 
 /* Copyright comment */
 %{
 
 /* Copyright comment */
 %{
@@ -177,11 +177,11 @@ make_name(void)
 %token TYPECAST
 
 /* ordinary key words in alphabetical order */
 %token TYPECAST
 
 /* ordinary key words in alphabetical order */
-%token <keyword> ABORT_TRANS ABSOLUTE ACCESS ACTION ADD AFTER
+%token <keyword> ABORT_P ABSOLUTE ACCESS ACTION ADD AFTER
         AGGREGATE ALL ALTER ANALYSE ANALYZE AND ANY AS ASC
        ASSERTION ASSIGNMENT AT AUTHORIZATION
 
         AGGREGATE ALL ALTER ANALYSE ANALYZE AND ANY AS ASC
        ASSERTION ASSIGNMENT AT AUTHORIZATION
 
-        BACKWARD BEFORE BEGIN_TRANS BETWEEN BIGINT BINARY BIT
+        BACKWARD BEFORE BEGIN_P BETWEEN BIGINT BINARY BIT
         BOOLEAN BOTH BY
 
         CACHE CALLED CASCADE CASE CAST CHAIN CHAR_P
         BOOLEAN BOTH BY
 
         CACHE CALLED CASCADE CASE CAST CHAIN CHAR_P
@@ -194,7 +194,7 @@ make_name(void)
         DATABASE DAY_P DEALLOCATE DEC DECIMAL DECLARE DEFAULT
        DEFERRABLE DEFERRED DEFINER DELETE_P DELIMITER DELIMITERS
        DESC DISTINCT DO DOMAIN_P DOUBLE DROP
         DATABASE DAY_P DEALLOCATE DEC DECIMAL DECLARE DEFAULT
        DEFERRABLE DEFERRED DEFINER DELETE_P DELIMITER DELIMITERS
        DESC DISTINCT DO DOMAIN_P DOUBLE DROP
-        EACH ELSE ENCODING ENCRYPTED END_TRANS ESCAPE EXCEPT EXCLUSIVE
+        EACH ELSE ENCODING ENCRYPTED END_P ESCAPE EXCEPT EXCLUSIVE
         EXECUTE EXISTS EXPLAIN EXTERNAL EXTRACT
 
         FALSE_P FETCH FLOAT_P FOR FORCE FOREIGN FORWARD FREEZE FROM
         EXECUTE EXISTS EXPLAIN EXTERNAL EXTRACT
 
         FALSE_P FETCH FLOAT_P FOR FORCE FOREIGN FORWARD FREEZE FROM
@@ -368,12 +368,12 @@ make_name(void)
 %type  <str>   CreateConversionStmt any_operator opclass_item_list
 %type  <str>   iso_level type_list CharacterWithLength ConstCharacter
 %type  <str>   CharacterWithoutLength BitWithLength BitWithoutLength
 %type  <str>   CreateConversionStmt any_operator opclass_item_list
 %type  <str>   iso_level type_list CharacterWithLength ConstCharacter
 %type  <str>   CharacterWithoutLength BitWithLength BitWithoutLength
-%type  <str>   ConstBit GenericType TableFuncElementList
+%type  <str>   ConstBit GenericType TableFuncElementList opt_analyze
 %type  <str>   opt_sort_clause transaction_access_mode
 
 %type  <str>   ECPGWhenever ECPGConnect connection_target ECPGOpen
 %type  <str>   indicator ECPGExecute ECPGPrepare opt_ecpg_using ecpg_into
 %type  <str>   opt_sort_clause transaction_access_mode
 
 %type  <str>   ECPGWhenever ECPGConnect connection_target ECPGOpen
 %type  <str>   indicator ECPGExecute ECPGPrepare opt_ecpg_using ecpg_into
-%type  <str>   storage_clause opt_initializer c_anything
+%type  <str>   storage_declaration storage_clause opt_initializer c_anything
 %type  <str>   variable_list variable c_thing c_term
 %type  <str>   opt_pointer ECPGDisconnect dis_name storage_modifier
 %type  <str>   ECPGRelease execstring server_name ECPGVarDeclaration
 %type  <str>   variable_list variable c_thing c_term
 %type  <str>   opt_pointer ECPGDisconnect dis_name storage_modifier
 %type  <str>   ECPGRelease execstring server_name ECPGVarDeclaration
@@ -416,6 +416,12 @@ statements: /*EMPTY*/
 
 statement: ecpgstart opt_at stmt ';'   { connection = NULL; }
                | ecpgstart stmt ';'
 
 statement: ecpgstart opt_at stmt ';'   { connection = NULL; }
                | ecpgstart stmt ';'
+               | ecpgstart ECPGVarDeclaration
+               {
+                       fprintf(yyout, "%s", $2);
+                        free($2);
+                       output_line_number();
+               }
                | ECPGDeclaration
                | c_thing               { fprintf(yyout, "%s", $1); free($1); }
                | CPP_LINE              { fprintf(yyout, "%s", $1); free($1); }
                | ECPGDeclaration
                | c_thing               { fprintf(yyout, "%s", $1); free($1); }
                | CPP_LINE              { fprintf(yyout, "%s", $1); free($1); }
@@ -652,12 +658,6 @@ stmt:  AlterDatabaseSetStmt { output_statement($1, 0, connection); }
 
                        output_simple_statement($1);
                }
 
                        output_simple_statement($1);
                }
-               | ECPGVarDeclaration
-               {
-                       fprintf(yyout, "%s", $1);
-                        free($1);
-                       output_line_number();
-               }
                | ECPGWhenever
                {
                        if (connection)
                | ECPGWhenever
                {
                        if (connection)
@@ -996,6 +996,9 @@ AlterTableStmt:
 /* ALTER TABLE <relation> DROP CONSTRAINT ... */
                | ALTER TABLE relation_expr DROP CONSTRAINT name opt_drop_behavior
                        { $$ = cat_str(5, make_str("alter table"), $3, make_str("drop constraint"), $6, $7); }
 /* ALTER TABLE <relation> DROP CONSTRAINT ... */
                | ALTER TABLE relation_expr DROP CONSTRAINT name opt_drop_behavior
                        { $$ = cat_str(5, make_str("alter table"), $3, make_str("drop constraint"), $6, $7); }
+/* ALTER TABLE <relation> SET WITHOUT OIDS  */
+               | ALTER TABLE relation_expr SET WITHOUT OIDS
+                       { $$ = cat_str(3, make_str("alter table"), $3, make_str("set without oids")); }
  /* ALTER TABLE <name> CREATE TOAST TABLE */
                | ALTER TABLE qualified_name CREATE TOAST TABLE
                        { $$ = cat_str(3, make_str("alter table"), $3, make_str("create toast table")); }
  /* ALTER TABLE <name> CREATE TOAST TABLE */
                | ALTER TABLE qualified_name CREATE TOAST TABLE
                        { $$ = cat_str(3, make_str("alter table"), $3, make_str("create toast table")); }
@@ -1358,7 +1361,11 @@ OptSeqElem:  CACHE NumConst
                        { $$ = cat2_str(make_str("maxvalue"), $2); }
                | MINVALUE NumConst
                        { $$ = cat2_str(make_str("minvalue"), $2); }
                        { $$ = cat2_str(make_str("maxvalue"), $2); }
                | MINVALUE NumConst
                        { $$ = cat2_str(make_str("minvalue"), $2); }
-               | START opt_by NumConst
+               | NO MAXVALUE
+                       { $$ = make_str("no maxvalue"); }
+               | NO MINVALUE
+                       { $$ = make_str("no minvalue"); }
+               | START opt_with NumConst
                        { $$ = cat_str(3, make_str("start"), $2, $3); }
                ;
 
                        { $$ = cat_str(3, make_str("start"), $2, $3); }
                ;
 
@@ -1547,8 +1554,6 @@ DefineStmt:  CREATE AGGREGATE func_name definition
                        { $$ = cat_str(3, make_str("create type"), $3, $4); }
                | CREATE TYPE_P any_name AS rowdefinition
                        { $$ = cat_str(4, make_str("create type"), $3, make_str("as"), $5); }
                        { $$ = cat_str(3, make_str("create type"), $3, $4); }
                | CREATE TYPE_P any_name AS rowdefinition
                        { $$ = cat_str(4, make_str("create type"), $3, make_str("as"), $5); }
-               | CREATE CHARACTER SET opt_as any_name GET definition opt_collate
-                       { $$ = cat_str(6, make_str("create character set"), $4, $5, make_str("get"), $7, $8); }
                ;
 
 rowdefinition: '(' TableFuncElementList ')'
                ;
 
 rowdefinition: '(' TableFuncElementList ')'
@@ -1692,7 +1697,6 @@ direction:        FORWARD         { $$ = make_str("forward"); }
 
 fetch_how_many: IntConst       { $$ = $1; }
                | ALL           { $$ = make_str("all"); }
 
 fetch_how_many: IntConst       { $$ = $1; }
                | ALL           { $$ = make_str("all"); }
-               | LAST          { $$ = make_str("last"); }
                | NEXT          { $$ = make_str("next"); }
                | PRIOR         { $$ = make_str("prior"); }
                ;
                | NEXT          { $$ = make_str("next"); }
                | PRIOR         { $$ = make_str("prior"); }
                ;
@@ -1757,9 +1761,6 @@ GrantStmt:        GRANT privileges ON privilege_target TO grantee_list opt_grant_grant_
 
 RevokeStmt:  REVOKE opt_revoke_grant_option privileges ON privilege_target FROM grantee_list opt_drop_behavior
                        {
 
 RevokeStmt:  REVOKE opt_revoke_grant_option privileges ON privilege_target FROM grantee_list opt_drop_behavior
                        {
-                         if (strcmp($8, "drop cascade") == 0)
-                               mmerror(PARSE_ERROR, ET_WARNING, "Not implemented REVOKE ... CASCADE will be send to backend");
-                       
                          $$ = cat_str(9, make_str("revoke"), $2, $3, make_str("on"), $5, make_str("from"), $7, $8);
                        }
                          
                          $$ = cat_str(9, make_str("revoke"), $2, $3, make_str("on"), $5, make_str("from"), $7, $8);
                        }
                          
@@ -2035,10 +2036,10 @@ any_operator:
                                { $$ = cat_str(3, $1, make_str("."), $3); }
                        ;
 
                                { $$ = cat_str(3, $1, make_str("."), $3); }
                        ;
 
-CreateCastStmt:                CREATE CAST '(' ConstTypename AS ConstTypename ')'
+CreateCastStmt:                CREATE CAST '(' Typename AS Typename ')'
                                WITH FUNCTION function_with_argtypes cast_context
                        { $$ = cat_str(6, make_str("create cast ("), $4, make_str("as"), $6, make_str(") with function"), $10); }
                                WITH FUNCTION function_with_argtypes cast_context
                        { $$ = cat_str(6, make_str("create cast ("), $4, make_str("as"), $6, make_str(") with function"), $10); }
-                       | CREATE CAST '(' ConstTypename AS ConstTypename ')'
+                       | CREATE CAST '(' Typename AS Typename ')'
                                WITHOUT FUNCTION cast_context
                        { $$ = cat_str(6, make_str("create cast ("), $4, make_str("as"), $6, make_str(") without function"), $10); }
                ;
                                WITHOUT FUNCTION cast_context
                        { $$ = cat_str(6, make_str("create cast ("), $4, make_str("as"), $6, make_str(") without function"), $10); }
                ;
@@ -2048,7 +2049,7 @@ cast_context: AS ASSIGNMENT   { $$ = make_str("as assignment"); }
                ;
 
 
                ;
 
 
-DropCastStmt: DROP CAST '(' ConstTypename AS ConstTypename ')' opt_drop_behavior
+DropCastStmt: DROP CAST '(' Typename AS Typename ')' opt_drop_behavior
                        { $$ = cat_str(6, make_str("drop cast ("), $4, make_str("as"), $6, make_str(")"), $8); }
                ;
 
                        { $$ = cat_str(6, make_str("drop cast ("), $4, make_str("as"), $6, make_str(")"), $8); }
                ;
 
@@ -2181,11 +2182,11 @@ UnlistenStmt:  UNLISTEN qualified_name
  *             (also older versions END / ABORT)
  *
  *****************************************************************************/
  *             (also older versions END / ABORT)
  *
  *****************************************************************************/
-TransactionStmt:  ABORT_TRANS opt_transaction          { $$ = make_str("rollback"); }
-               | BEGIN_TRANS opt_transaction           { $$ = make_str("begin transaction"); }
+TransactionStmt:  ABORT_P opt_transaction              { $$ = make_str("rollback"); }
+               | BEGIN_P opt_transaction               { $$ = make_str("begin transaction"); }
                | START TRANSACTION transaction_mode_list_or_empty      { $$ = cat2_str(make_str("start transaction"), $3); }
                | COMMIT opt_transaction                { $$ = make_str("commit"); }
                | START TRANSACTION transaction_mode_list_or_empty      { $$ = cat2_str(make_str("start transaction"), $3); }
                | COMMIT opt_transaction                { $$ = make_str("commit"); }
-               | END_TRANS opt_transaction             { $$ = make_str("commit"); }
+               | END_P opt_transaction         { $$ = make_str("commit"); }
                | ROLLBACK opt_transaction              { $$ = make_str("rollback"); }
                ;
 
                | ROLLBACK opt_transaction              { $$ = make_str("rollback"); }
                ;
 
@@ -2413,12 +2414,17 @@ opt_name_list:  '(' name_list ')'
  *
  *****************************************************************************/
 
  *
  *****************************************************************************/
 
-ExplainStmt:  EXPLAIN opt_verbose OptimizableStmt
-                       { $$ = cat_str(3, make_str("explain"), $2, $3); }
-               | EXPLAIN analyze_keyword opt_verbose OptimizableStmt
+ExplainStmt:  EXPLAIN opt_analyze opt_verbose OptimizableStmt
                        { $$ = cat_str(4, make_str("explain"), $2, $3, $4); }
                        { $$ = cat_str(4, make_str("explain"), $2, $3, $4); }
+/*             | EXPLAIN opt_analyze opt_verbose ExecuteStmt
+                       { $$ = cat_str(4, make_str("explain"), $2, $3, $4); }*/
                ;
 
                ;
 
+opt_analyze:
+       analyze_keyword                 { $$ = $1; }
+       | /* EMPTY */                   { $$ = EMPTY; }
+       ;
+
 /*
 
 conflicts with ecpg
 /*
 
 conflicts with ecpg
@@ -2939,8 +2945,8 @@ TableFuncElement: ColId Typename  { $$ = cat2_str($1, $2); }
 
 Typename:  SimpleTypename opt_array_bounds
                        { $$ = cat2_str($1, $2.str); }
 
 Typename:  SimpleTypename opt_array_bounds
                        { $$ = cat2_str($1, $2.str); }
-               | SETOF SimpleTypename
-                       { $$ = cat2_str(make_str("setof"), $2); }
+               | SETOF SimpleTypename opt_array_bounds
+                       { $$ = cat_str(3, make_str("setof"), $2, $3); }
                ;
 
 
                ;
 
 
@@ -3628,7 +3634,7 @@ in_expr:  select_with_parens
  * same as CASE WHEN a IS NOT NULL THEN a WHEN b IS NOT NULL THEN b ... END
  * - thomas 1998-11-09
  */
  * same as CASE WHEN a IS NOT NULL THEN a WHEN b IS NOT NULL THEN b ... END
  * - thomas 1998-11-09
  */
-case_expr:     CASE case_arg when_clause_list case_default END_TRANS
+case_expr:     CASE case_arg when_clause_list case_default END_P
                        { $$ = cat_str(5, make_str("case"), $2, $3, $4, make_str("end")); }
                | NULLIF '(' a_expr ',' a_expr ')'
                        { $$ = cat_str(5, make_str("nullif("), $3, make_str(","), $5, make_str(")")); }
                        { $$ = cat_str(5, make_str("case"), $2, $3, $4, make_str("end")); }
                | NULLIF '(' a_expr ',' a_expr ')'
                        { $$ = cat_str(5, make_str("nullif("), $3, make_str(","), $5, make_str(")")); }
@@ -4140,29 +4146,25 @@ single_vt_declaration: type_declaration         { $$ = $1; }
                | single_var_declaration        { $$ = $1; }
                ;
        
                | single_var_declaration        { $$ = $1; }
                ;
        
-single_var_declaration: storage_clause storage_modifier
-               {
-                       actual_storage[struct_level] = cat2_str(mm_strdup($1), mm_strdup($2));
-                       actual_startline[struct_level] = hashline_number();
-               }
+single_var_declaration: storage_declaration
                single_vt_type
                {
                single_vt_type
                {
-                       actual_type[struct_level].type_enum = $4.type_enum;
-                       actual_type[struct_level].type_dimension = $4.type_dimension;
-                       actual_type[struct_level].type_index = $4.type_index;
-                       actual_type[struct_level].type_sizeof = $4.type_sizeof;
+                       actual_type[struct_level].type_enum = $2.type_enum;
+                       actual_type[struct_level].type_dimension = $2.type_dimension;
+                       actual_type[struct_level].type_index = $2.type_index;
+                       actual_type[struct_level].type_sizeof = $2.type_sizeof;
 
                        /* we do not need the string "varchar" for output */
                        /* so replace it with an empty string */
 
                        /* we do not need the string "varchar" for output */
                        /* so replace it with an empty string */
-                       if ($4.type_enum == ECPGt_varchar)
+                       if ($2.type_enum == ECPGt_varchar)
                        {
                        {
-                               free($4.type_str);
-                               $4.type_str=EMPTY;
+                               free($2.type_str);
+                               $2.type_str=EMPTY;
                        }
                }
                        }
                }
-               variable_list 
+               variable_list ';'
                {
                {
-                       $$ = cat_str(6, actual_startline[struct_level], $1, $2, $4.type_str, $6, make_str(";\n"));
+                       $$ = cat_str(5, actual_startline[struct_level], $1, $2.type_str, $4, make_str(";\n"));
                }
                ;
 
                }
                ;
 
@@ -4225,9 +4227,9 @@ ECPGDeclaration: sql_startdeclare
                }
                ;
 
                }
                ;
 
-sql_startdeclare: ecpgstart BEGIN_TRANS DECLARE SQL_SECTION ';' {};
+sql_startdeclare: ecpgstart BEGIN_P DECLARE SQL_SECTION ';' {};
 
 
-sql_enddeclare: ecpgstart END_TRANS DECLARE SQL_SECTION ';' {};
+sql_enddeclare: ecpgstart END_P DECLARE SQL_SECTION ';' {};
 
 var_type_declarations: /*EMPTY*/                       { $$ = EMPTY; }
                | vt_declarations                       { $$ = $1; }
 
 var_type_declarations: /*EMPTY*/                       { $$ = EMPTY; }
                | vt_declarations                       { $$ = $1; }
@@ -4305,29 +4307,32 @@ type_declaration: S_TYPEDEF
                $$ = make_str("");
        };
 
                $$ = make_str("");
        };
 
-var_declaration: storage_clause storage_modifier
-               {
-                       actual_storage[struct_level] = cat2_str(mm_strdup($1), mm_strdup($2));
-                       actual_startline[struct_level] = hashline_number();
-               }
+var_declaration: storage_declaration
                type
                {
                type
                {
-                       actual_type[struct_level].type_enum = $4.type_enum;
-                       actual_type[struct_level].type_dimension = $4.type_dimension;
-                       actual_type[struct_level].type_index = $4.type_index;
-                       actual_type[struct_level].type_sizeof = $4.type_sizeof;
+                       actual_type[struct_level].type_enum = $2.type_enum;
+                       actual_type[struct_level].type_dimension = $2.type_dimension;
+                       actual_type[struct_level].type_index = $2.type_index;
+                       actual_type[struct_level].type_sizeof = $2.type_sizeof;
 
                        /* we do not need the string "varchar" for output */
                        /* so replace it with an empty string */
 
                        /* we do not need the string "varchar" for output */
                        /* so replace it with an empty string */
-                       if ($4.type_enum == ECPGt_varchar)
+                       if ($2.type_enum == ECPGt_varchar)
                        {
                        {
-                               free($4.type_str);
-                               $4.type_str=EMPTY;
+                               free($2.type_str);
+                               $2.type_str=EMPTY;
                        }
                }
                variable_list ';'
                {
                        }
                }
                variable_list ';'
                {
-                       $$ = cat_str(6, actual_startline[struct_level], $1, $2, $4.type_str, $6, make_str(";\n"));
+                       $$ = cat_str(5, actual_startline[struct_level], $1, $2.type_str, $4, make_str(";\n"));
+               }
+               ;
+
+storage_declaration: storage_clause storage_modifier
+               {
+                       actual_storage[struct_level] = cat2_str(mm_strdup($1), mm_strdup($2));
+                       actual_startline[struct_level] = hashline_number();
                }
                ;
 
                }
                ;
 
@@ -5221,7 +5226,7 @@ ECPGColLabel:  ECPGColLabelCommon                 { $$ = $1; }
 /* "Unreserved" keywords --- available for use as any kind of name.
  */
 unreserved_keyword:
 /* "Unreserved" keywords --- available for use as any kind of name.
  */
 unreserved_keyword:
-                 ABORT_TRANS                                   { $$ = make_str("abort"); }
+                 ABORT_P                                       { $$ = make_str("abort"); }
                | ABSOLUTE                                              { $$ = make_str("absolute"); }
                | ACCESS                                                { $$ = make_str("access"); }
                | ACTION                                                { $$ = make_str("action"); }
                | ABSOLUTE                                              { $$ = make_str("absolute"); }
                | ACCESS                                                { $$ = make_str("access"); }
                | ACTION                                                { $$ = make_str("action"); }
@@ -5234,7 +5239,7 @@ unreserved_keyword:
                | AT                                                    { $$ = make_str("at"); }
                | BACKWARD                                              { $$ = make_str("backward"); }
                | BEFORE                                                { $$ = make_str("before"); }
                | AT                                                    { $$ = make_str("at"); }
                | BACKWARD                                              { $$ = make_str("backward"); }
                | BEFORE                                                { $$ = make_str("before"); }
-               | BEGIN_TRANS                                   { $$ = make_str("begin"); }
+               | BEGIN_P                                       { $$ = make_str("begin"); }
                | BY                                                    { $$ = make_str("by"); }
                | CACHE                                                 { $$ = make_str("cache"); }
                | CASCADE                                               { $$ = make_str("cascade"); }
                | BY                                                    { $$ = make_str("by"); }
                | CACHE                                                 { $$ = make_str("cache"); }
                | CASCADE                                               { $$ = make_str("cascade"); }
@@ -5293,7 +5298,6 @@ unreserved_keyword:
                | KEY                                                   { $$ = make_str("key"); }
                | LANCOMPILER                                           { $$ = make_str("lancompiler"); }
                | LANGUAGE                                              { $$ = make_str("language"); }
                | KEY                                                   { $$ = make_str("key"); }
                | LANCOMPILER                                           { $$ = make_str("lancompiler"); }
                | LANGUAGE                                              { $$ = make_str("language"); }
-               | LAST                                                  { $$ = make_str("last"); }
                | LEVEL                                                 { $$ = make_str("level"); }
                | LISTEN                                                { $$ = make_str("listen"); }
                | LOAD                                                  { $$ = make_str("load"); }
                | LEVEL                                                 { $$ = make_str("level"); }
                | LISTEN                                                { $$ = make_str("listen"); }
                | LOAD                                                  { $$ = make_str("load"); }
@@ -5504,7 +5508,7 @@ reserved_keyword:
                | DISTINCT                                              { $$ = make_str("distinct"); }
                | DO                                                    { $$ = make_str("do"); }
                | ELSE                                                  { $$ = make_str("else"); }
                | DISTINCT                                              { $$ = make_str("distinct"); }
                | DO                                                    { $$ = make_str("do"); }
                | ELSE                                                  { $$ = make_str("else"); }
-               | END_TRANS                                             { $$ = make_str("end"); }
+               | END_P                                         { $$ = make_str("end"); }
                | EXCEPT                                                { $$ = make_str("except"); }
                | FALSE_P                                               { $$ = make_str("false"); }
                | FOR                                                   { $$ = make_str("for"); }
                | EXCEPT                                                { $$ = make_str("except"); }
                | FALSE_P                                               { $$ = make_str("false"); }
                | FOR                                                   { $$ = make_str("for"); }
index c624de2625a87f371f2ce29d6c32352655c06759..b11ce408925445a41d754053d44e34fcc54697ed 100644 (file)
@@ -23,14 +23,15 @@ exec sql begin declare section;
        struct personal_indicator {     int ind_name;
                                        birthinfo ind_birth;
                                  } ind_personal, *i;
        struct personal_indicator {     int ind_name;
                                        birthinfo ind_birth;
                                  } ind_personal, *i;
-       float ind_married;
-       ind children;
        ind ind_children;
        ind ind_children;
-       char *married = NULL;
        c testname="Petra";
        char *query="select name, born, age, married, children from meskes where name = :var1";
 exec sql end declare section;
 
        c testname="Petra";
        char *query="select name, born, age, married, children from meskes where name = :var1";
 exec sql end declare section;
 
+       exec sql char *married = NULL;
+       exec sql float ind_married;
+       exec sql ind children;
+
        exec sql var ind_married is long;
 
        exec sql declare cur cursor for
        exec sql var ind_married is long;
 
        exec sql declare cur cursor for