*** empty log message ***
authorMichael Meskes
Mon, 14 Feb 2000 10:00:06 +0000 (10:00 +0000)
committerMichael Meskes
Mon, 14 Feb 2000 10:00:06 +0000 (10:00 +0000)
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/lib/ecpglib.c
src/interfaces/ecpg/preproc/extern.h
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/test/stp.pgc
src/interfaces/ecpg/test/test5.pgc

index aaa63f616a211df44e86d28fbec84b419164e8ae..fec7608a6c42bc0804c07ef046deb7c32f16c607 100644 (file)
@@ -790,6 +790,9 @@ Thu Jan 27 08:12:05 CET 2000
    - Fixed error messages in pgc.l.
    - Improved variable parsing.
    - Synced preproc.y with gram.y.
+
+Mon Feb 14 10:35:18 CET 2000
+
+   - Synced preproc.y with gram.y.
    - Set library version to 3.0.10.
    - Set ecpg version to 2.7.0.
-
index 7e755782715b8d99b22fbc35acec7212c0e1696b..15440d09d9dcafa1009aef162d154ee208728c5f 100644 (file)
@@ -395,7 +395,7 @@ ECPGexecute(struct statement * stmt)
 {
    bool        status = false;
    char       *copiedquery;
-   PGresult   *results;
+   PGresult   *results, *query;
    PGnotify   *notify;
    struct variable *var;
 
@@ -669,7 +669,8 @@ ECPGexecute(struct statement * stmt)
                {
                    char       *pval;
                    char       *scan_length;
-
+                   char       *array_query;
+                   
                    if (var == NULL)
                    {
                        ECPGlog("ECPGexecute line %d: Too few arguments.\n", stmt->lineno);
@@ -724,10 +725,15 @@ ECPGexecute(struct statement * stmt)
                        *((void **) var->pointer) = var->value;
                        add_mem(var->value, stmt->lineno);
                    }
-                   
-                   
-                   ECPGlog("ECPGexecute line %d: TYPE db: %d c: %d\n", stmt->lineno, PQftype(results, act_field), var->type);
-
+                                       
+#if 0
+                   array_query = (char *)ecpg_alloc(strlen("select typelem from pg_type where oid=") + 11, stmt -> lineno);
+                   sprintf(array_query, "select typelem from pg_type where oid=%d", PQftype(results, act_field));
+                   query = PQexec(stmt->connection->connection, array_query);
+                   if (PQresultStatus(query) == PGRES_TUPLES_OK)
+                       ECPGlog("ECPGexecute line %d: TYPE database: %d C: %d array OID: %s\n", stmt->lineno, PQftype(results, act_field), var->type, (char *)PQgetvalue(query, 0, 0));
+                   PQclear(query);
+#endif
                    for (act_tuple = 0; act_tuple < ntuples && status; act_tuple++)
                    {
                        pval = (char *)PQgetvalue(results, act_tuple, act_field);
index 9aae32af26deb64bb8999be66808b1baa9750095..682ead43ec81b9154c66c2632833f16da61b7f80 100644 (file)
@@ -37,7 +37,7 @@ extern void lex_init(void);
 extern char *input_filename;
 extern int yyparse(void);
 extern int yylex(void);
-extern void yyerror(const char * error);
+extern void yyerror(char *);
 extern void *mm_alloc(size_t), *mm_realloc(void *, size_t);
 extern char *mm_strdup(const char *);
 extern void mmerror(enum errortype, char * );
index 28b66abb24aaf1370ebecf1b8a3d703e0f1a97fb..be4227eb1cc90378ab737462639f183d89bd0c88 100644 (file)
@@ -760,9 +760,9 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
 %type     opt_collate Datetime datetime opt_timezone opt_interval
 %type     numeric a_expr_or_null row_expr row_descriptor row_list
 %type     SelectStmt SubSelect result OptTemp OptTempType OptTempScope
-%type     opt_table opt_all opt_unique sort_clause sortby_list
+%type     opt_table opt_all sort_clause sortby_list
 %type     sortby OptUseOp opt_inh_star relation_name_list name_list
-%type     group_clause having_clause from_clause
+%type     group_clause having_clause from_clause opt_distinct
 %type     table_list join_outer where_clause relation_expr sub_type
 %type     opt_column_list insert_rest InsertStmt OptimizableStmt
 %type      columnList DeleteStmt LockStmt UpdateStmt CursorStmt
@@ -1306,35 +1306,35 @@ AlterTableStmt:
 /* ALTER TABLE  ADD [COLUMN]  */
         ALTER TABLE relation_name opt_inh_star ADD opt_column columnDef
        {
-           $$ = cat_str(5, make_str("alter table"), $3, $4, make_str("add"), $6, $7);
+           $$ = cat_str(6, make_str("alter table"), $3, $4, make_str("add"), $6, $7);
        }
 /* ALTER TABLE  ALTER [COLUMN]  {SET DEFAULT |DROP
 DEFAULT} */
    | ALTER TABLE relation_name opt_inh_star ALTER opt_column ColId
        alter_column_action
        {
-           $$ = cat_str(6, make_str("alter table"), $3, $4, make_str("alter"), $6, $7, $8);
+           $$ = cat_str(7, make_str("alter table"), $3, $4, make_str("alter"), $6, $7, $8);
        }
 /* ALTER TABLE  DROP [COLUMN]  {RESTRICT|CASCADE} */
-   | ALTER TABLE relation_name opt_inh_star DROP opt_column ColId
-       /* drop_behavior */
+   | ALTER TABLE relation_name opt_inh_star DROP opt_column ColId drop_behavior
        {
-           $$ = cat_str(5, make_str("alter table"), $3, $4, make_str("drop"), $6, $7);
+           $$ = cat_str(7, make_str("alter table"), $3, $4, make_str("drop"), $6, $7, $8);
        }
 /* ALTER TABLE  ADD CONSTRAINT ... */
    | ALTER TABLE relation_name opt_inh_star ADD TableConstraint
        {
-           $$ = cat_str(4, make_str("alter table"), $3, $4, make_str("add"), $6);
+           $$ = cat_str(5, make_str("alter table"), $3, $4, make_str("add"), $6);
        }
 /* ALTER TABLE  DROP CONSTRAINT ... */
    | ALTER TABLE relation_name opt_inh_star DROP CONSTRAINT name drop_behavior
        {
-           $$ = cat_str(5, make_str("alter table"), $3, $4, make_str("drop constraint"), $7, $8);
+           $$ = cat_str(6, make_str("alter table"), $3, $4, make_str("drop constraint"), $7, $8);
        }
        ;
 
 alter_column_action:
-        SET DEFAULT a_expr_or_null { $$ = cat2_str(make_str("set default"), $3); }
+        SET DEFAULT a_expr { $$ = cat2_str(make_str("set default"), $3); }
+        | SET DEFAULT NULL_P    { $$ = make_str("set default null"); }
         | DROP DEFAULT          { $$ = make_str("drop default"); }
         ;
 
@@ -1579,7 +1579,6 @@ key_match:  MATCH FULL
        }
        | /*EMPTY*/
        {
-           mmerror(ET_WARN, "FOREIGN KEY match type UNSPECIFIED not implemented yet");
            $$ = EMPTY;
        }
        ;
@@ -1735,7 +1734,7 @@ CreateTrigStmt:  CREATE TRIGGER name TriggerActionTime TriggerEvents ON
                {
                    $$ = cat_str(12, make_str("create trigger"), $3, $4, $5, make_str("on"), $7, $8, make_str("execute procedure"), $11, make_str("("), $13, make_str(")"));
                }
-   |   CREATE CONSTRAINT TRIGGER name AFTER TriggerOneEvent ON
+   |   CREATE CONSTRAINT TRIGGER name AFTER TriggerEvents ON
                                 relation_name OptConstrFromTable
                ConstraintAttributeSpec
                                 FOR EACH ROW EXECUTE PROCEDURE
@@ -2507,12 +2506,8 @@ UnlistenStmt:  UNLISTEN relation_name
  *
  *              Transactions:
  *
- *              abort transaction
- *                              (ABORT)
- *              begin transaction
- *                              (BEGIN)
- *              end transaction  
- *                              (END)
+ *   BEGIN / COMMIT / ROLLBACK
+ *      (also older versions END / ABORT)
  *
  *****************************************************************************/
 TransactionStmt:  ABORT_TRANS opt_trans    { $$ = make_str("rollback"); }
@@ -2912,7 +2907,7 @@ select_clause: '(' select_clause ')'
            }
        ;
 
-SubSelect:     SELECT opt_unique target_list
+SubSelect:     SELECT opt_distinct target_list
                          result from_clause where_clause
                          group_clause having_clause
                {
@@ -2937,8 +2932,8 @@ opt_all:  ALL                     { $$ = make_str("all"); }
        | /*EMPTY*/             { $$ = EMPTY; }
        ;
 
-opt_unique:  DISTINCT                  { $$ = make_str("distinct"); }
-       | DISTINCT ON ColId         { $$ = cat2_str(make_str("distinct on"), $3); }
+opt_distinct:  DISTINCT                    { $$ = make_str("distinct"); }
+       | DISTINCT ON '(' expr_list ')'     { $$ = cat_str(3, make_str("distinct on ("), $4, make_str(")")); }
        | ALL                   { $$ = make_str("all"); }
        | /*EMPTY*/             { $$ = EMPTY; }
        ;
@@ -5428,7 +5423,7 @@ blockend : '}' {
 
 %%
 
-void yyerror(const char * error)
+void yyerror(char * error)
 {
    mmerror(ET_ERROR, error);
 }
index 6021ae0db40ff14673e936a2771a8fa855ad66ea..a069077bf02bebe93e1a27609aa97908054a6c42 100644 (file)
@@ -5,9 +5,19 @@ int my_fun (void)
    EXEC SQL BEGIN DECLARE SECTION;
    int         sql_index = 0;
    EXEC SQL END DECLARE SECTION;   
+   FILE *dbgs;
+
+   if ((dbgs = fopen("/tmp/log", "w")) != NULL)
+                ECPGdebug(1, dbgs);
 
    EXEC SQL WHENEVER SQLERROR GOTO Error;
+
+   EXEC SQL CONNECT TO 'mm';
    EXEC SQL SELECT MIN(index) INTO :sql_index FROM tab;
+   EXEC SQL DISCONNECT;
+
+   if (dbgs != NULL)
+                fclose(dbgs);  
 
    return (sql_index);
 
index 1e0c60c4ddbff5b14afd44bd5b27a8699ebc0742..3c8c4249c1bddb8169a9fefaf8b580cfd0155fc9 100644 (file)
@@ -13,7 +13,6 @@ int main (void)
    EXEC SQL END DECLARE SECTION;
    FILE *dbgs;
    
-   
         if ((dbgs = fopen("log", "w")) != NULL)
                 ECPGdebug(1, dbgs);