Re: [PATCHES] ecpg generates wrong code for EXEC SQL FREE
От | Bruce Momjian |
---|---|
Тема | Re: [PATCHES] ecpg generates wrong code for EXEC SQL FREE |
Дата | |
Msg-id | 199911231943.OAA10770@candle.pha.pa.us обсуждение исходный текст |
Ответ на |
ecpg generates wrong code for EXEC SQL FREE |
Список | pgsql-bugs |
Thanks. This will appear in 7.0. > ============================================================================ > POSTGRESQL BUG REPORT > ============================================================================ > > > Your name : Rene Hogendoorn > Your email address : hogend@nlr.nl > > > System Configuration > --------------------- > Architecture (example: Intel Pentium) : Intel PII / dec alpha > > Operating System (example: Linux 2.0.26 ELF) : Redhat 6.1 / DUNIX 4.0f > > PostgreSQL version (example: PostgreSQL-6.5.3): PostgreSQL-6.5.3 > > Compiler used (example: gcc 2.8.0) : egcs 1.1.2 / gcc 2.7.2.2 > > > Please enter a FULL description of your problem: > ------------------------------------------------ > > ecpg generates wrong code for EXEC SQL FREE <cursor>. > The code generated, looks like > > if( Successful( "Database_c::Delete_via_WHERE", "cannot prepare the statement", __LINE__, __FILE__)) > { > { ECPGdo(__LINE__, NULL, "?", > ECPGt_char_variable,(ECPGprepared_statement("st1")),1L,1L,1*sizeof(char), > ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} > #line 279 "/home/tradefp1/hogend/SASS-C/SASS-C/Dev/common/gendbi_common/src/database.ec" > > Successful( "Database_c::Delete_via_WHERE", "Cannot execute the statement", __LINE__, __FILE__); > } > delete [] stmnt; > stmnt = 0; > { ECPGdeallocate(__LINE__, NULL, "st1");} > > ^^^^^^ > > The problem is that ECPGdeallocate has only two arguments > > Please describe a way to repeat the problem. Please try to provide a > concise reproducible example, if at all possible: > ---------------------------------------------------------------------- > > EXEC SQL BEGIN DECLARE SECTION; > char * stmnt; > EXEC SQL END DECLARE SECTION; > > stmnt = new char[len_ + 1]; > if( stmnt == 0 ) > return memerr( __LINE__, __FILE__ ); > sprintf( stmnt,"DELETE FROM %s WHERE %s", _table, _where_clause ); > EXEC SQL PREPARE st1 FROM :stmnt; > > // if (SQLCODE == NO_SQL_ERROR) > if( Successful( "Database_c::Delete_via_WHERE", "cannot prepare the statement", __LINE__, __FILE__)) > { > EXEC SQL EXECUTE st1; > //if( SQLCODE == NO_SQL_ERROR) > //{ > //} > Successful( "Database_c::Delete_via_WHERE", "Cannot execute the statement", __LINE__, __FILE__); > // end of modifications ....................................................................... > } > delete [] stmnt; > stmnt = 0; > > EXEC SQL FREE st1; > > > > > If you know how this problem might be fixed, list the solution below: > --------------------------------------------------------------------- > > diff -c postgresql-6.5.3/src/interfaces/ecpg/preproc/preproc.y.orig postgresql-6.5.3/src/interfaces/ecpg/preproc/preproc.y > *** postgresql-6.5.3/src/interfaces/ecpg/preproc/preproc.y.orig Sat Jul 10 00:53:40 1999 > --- postgresql-6.5.3/src/interfaces/ecpg/preproc/preproc.y Tue Nov 23 14:53:42 1999 > *************** > *** 956,962 **** > output_statement($1, 0); > } > | ECPGFree { > ! fprintf(yyout, "{ ECPGdeallocate(__LINE__, %s, \"%s\");", connection ? connection: "NULL", $1); > whenever_action(2); > free($1); > } > --- 956,974 ---- > output_statement($1, 0); > } > | ECPGFree { > ! fprintf(yyout, "{ ECPGdeallocate(__LINE__, \"%s\");", $1); > whenever_action(2); > free($1); > } > -- > > R. A. Hogendoorn E-mail: hogend@nlr.nl > Information and Communication Technology Division Tel. +31-527-24-8367 > National Aerospace Laboratory, The Netherlands Fax. +31-527-24-8210 > > ************ > > -- 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, Pennsylvania 19026
В списке pgsql-bugs по дате отправления: