Thread: Re: [HACKERS] ecpg fixes

Re: [HACKERS] ecpg fixes

From
Bruce Momjian
Date:

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
 


Re: [HACKERS] ecpg fixes

From
Michael Meskes
Date:
On Mon, May 10, 1999 at 01:00:45AM -0400, Bruce Momjian wrote:
> 
> 
> Can someone comment on this?  It looks like part of this is applied, but
> not all of it.
> ...
It should be all committed. That is I changed pgc.l a little bit so maybe
that's the reason. If something's really missing, please tell me.

Michael
-- 
Michael Meskes                         | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
Email: Michael.Meskes@gmx.net          | Use PostgreSQL!


Re: [HACKERS] ecpg fixes

From
Bruce Momjian
Date:
> On Mon, May 10, 1999 at 01:00:45AM -0400, Bruce Momjian wrote:
> > 
> > 
> > Can someone comment on this?  It looks like part of this is applied, but
> > not all of it.
> > ...
>  
> It should be all committed. That is I changed pgc.l a little bit so maybe
> that's the reason. If something's really missing, please tell me.

Michael, there was a function that looks like it fixed some memory leak.
Do you have the patch there so you can package up one that matches the
current sources?  I am stumped on what it was trying to do.

--  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