Re: [HACKERS] ecpg fixes - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] ecpg fixes
Date
Msg-id 199905100500.BAA23953@candle.pha.pa.us
Whole thread Raw
Responses Re: [HACKERS] ecpg fixes  (Michael Meskes <meskes@postgresql.org>)
List pgsql-hackers

Can someone comment on this?  It looks like part of this is applied, but
not all of it.


> Included are patches for 4/1 snapshot, submitted by Masaaki Sakaida.
> 
> o Allow ecpg handle a floating point constant having more than 10 places
> o Fix ecpg runtime library memory leak
> --
> Tatsuo Ishii
> ------------------------------------------------------------
> *** src/interfaces/ecpg/preproc/pgc.l.orig    Thu Apr  1 17:41:04 1999
> --- src/interfaces/ecpg/preproc/pgc.l    Thu Apr  1 17:41:10 1999
> ***************
> *** 461,466 ****
> --- 461,475 ----
>                       }
>                       return ICONST;
>                   }
> + <C>{real}            {
> +                     char* endptr;
> + 
> +                     errno = 0;
> +                     yylval.dval = strtod((char *)yytext,&endptr);
> +                     if (*endptr != '\0' || errno == ERANGE)
> +                         yyerror("ERROR: Bad float input");
> +                     return FCONST;
> +                 }
>   <SQL>:{identifier}(("->"|\.){identifier})*    {
>                       yylval.str = mm_strdup((char*)yytext+1);
>                       return(CVARIABLE);
> 
> ------------------------------------------------------------
> 
> 
> ------------------------------------------------------------
> *** src/interfaces/ecpg/lib/ecpglib.c.orig    Thu Apr  1 17:10:52 1999
> --- src/interfaces/ecpg/lib/ecpglib.c    Thu Apr  1 17:22:12 1999
> ***************
> *** 370,375 ****
> --- 370,403 ----
>       return (true);
>   }
>   
> + static void
> + free_variable(struct variable *var)
> + {
> +     struct variable    *var_next;
> + 
> +     if( var == (struct variable *)NULL ) 
> +         return; 
> +     var_next = var->next;
> +     free(var);
> + 
> +     while(var_next)
> +     {
> +         var = var_next;
> +         var_next = var->next;
> +         free(var);
> +     }
> + }
> + 
> + static void
> + free_statement(struct statement *stmt)
> + {
> +     if( stmt == (struct statement *)NULL ) 
> +         return;
> +     free_variable(stmt->inlist);
> +     free_variable(stmt->outlist);
> +     free(stmt);
> + }
> + 
>   static char *
>   next_insert(char *text)
>   {
> ***************
> *** 981,987 ****
>                       status = false;
>                   }
>   
> -                 PQclear(results);
>                   break;
>               case PGRES_EMPTY_QUERY:
>                   /* do nothing */
> --- 1009,1014 ----
> ***************
> *** 1017,1022 ****
> --- 1044,1050 ----
>                   status = false;
>                   break;
>           }
> +         PQclear(results);
>       }
>   
>       /* check for asynchronous returns */
> ***************
> *** 1037,1042 ****
> --- 1065,1071 ----
>       va_list        args;
>       struct statement *stmt;
>       struct connection *con = get_connection(connection_name);
> +     bool        status;
>   
>       if (con == NULL)
>       {
> ***************
> *** 1057,1063 ****
>           return false;
>       }
>   
> !     return (ECPGexecute(stmt));
>   }
>   
>   bool
> --- 1086,1094 ----
>           return false;
>       }
>   
> !     status = ECPGexecute(stmt);
> !     free_statement(stmt);
> !     return (status);
>   }
>   
>   bool
> 
> 
> 


--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] INSERT INTO
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Parser bug: alias is a "non-group column"?