From: | Rene Hogendoorn <hogend(at)nlr(dot)nl> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | ecpg generates wrong code for EXEC SQL FREE <cursor> |
Date: | 1999-11-23 15:50:03 |
Message-ID: | 14394.47019.176355.737359@tradef1-fe.nlr.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
============================================================================
POSTGRESQL BUG REPORT
============================================================================
Your name : Rene Hogendoorn
Your email address : hogend(at)nlr(dot)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(at)nlr(dot)nl
Information and Communication Technology Division Tel. +31-527-24-8367
National Aerospace Laboratory, The Netherlands Fax. +31-527-24-8210
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Forsman | 1999-11-23 16:28:36 | Unable to match record |
Previous Message | Rene Hogendoorn | 1999-11-23 15:36:51 | ecpg sqlca.h bug |