Обсуждение: ecpg error --> DbPg_cre_sect_buf.pgc:1334: ERROR: syntax error at or near "RELEASE"
ecpg error --> DbPg_cre_sect_buf.pgc:1334: ERROR: syntax error at or near "RELEASE"
От
jason.ctr.alburger@faa.gov
Дата:
I'm relatively new to database programming & I've inherited a system to
maintain that contains lots of embedded SQL. I'm attempting to port my C
source code from RH 7.2 (with ecpg 2.8.0) to Mandrake 10.0 (with ecpg
4.1.1). ecpg 4.1.1 is generating an error which I did not get on the
RH7.2 system with ecpg 2.8.0....It's telling me I have a syntax error with
a "ROLLBACK RELEASE" (DbPg_cre_sect_buf.pgc:1334: ERROR: syntax error at or
near "RELEASE"). Here's a snippet of the code in error...
.
.
.
1320 /* Ignore termination signal (if rcvd) - terminating anyway
*/
1321 signal(SIGTERM, SIG_IGN);
1322
1323 /* send a message to the client that download has
terminated abnormally */
1324 DbgS1(10, DBG_DRW_3, sqlca.sqlerrm.sqlerrmc);
1325 DbgI1(10, DBG_DRW_3, -sqlca.sqlcode);
1326
1327 EXEC SQL WHENEVER SQLERROR CONTINUE;
1328 EXEC SQL CLOSE cms_sec_curr;
1329
1330 if (fpa_curs)
1331 {
1332 DbPgCC_sector_assign_status ();
1333 }
1334 EXEC SQL ROLLBACK RELEASE;
1335
1336 DbgS1(11, DBG_DRW_3,
1337 "Closed Connection to the Database Due to Postgres
Error");
.
.
.
Can anybody help?
Thanks in advance!
PS...If it helps any, here's the ecpg execution statement...
/usr/bin/ecpg -o RL86DbPg_cre_sect_buf.c -DECPG_COMPILE -D__EXTENSIONS__
-DTARG_I686 -D"TARG_SMP=1" -DLOCK_PORTABLE=1 -DLOCK_SVID -DNO_FDX_IPC
-DHOST_SET_CMS6 -I. -DHOST_SET_CMS -DHOST_SET_CMS3 -DHOST_SET_CMS4
-DHOST_SET_CMS5 -DBLD_TYP=HDDS -DFIN_IST=1 -DFIN_DST=0 -DFIN_PST=0
-DFIN_STT=0 -DFIN_STE=0 -DFIN_NAE=1 -DFAP_CSP=0 -DFAP_DDS=1 -DFMC_ARC=0
-DFMC_CTS=0 -DFMC_DRA=0 -DFMC_HCI=1 -DFMC_PFM=0 -DFMC_RMS=0 -DFMC_UCD=1
-DFMC_EAA=1 -DFCI_TCP=1 -DFCI_UDP=1 -DFCI_UDG=1 -DFCI_TSS=0 -DFCI_LWS=0
-I- -I. -I/usr/local/include/ucd-snmp -I/usr/local/include -I/usr/include
-I/usr/include/pgsql -I/home/jalburger/opt/hadds/src/hdr -I/usr/include
DbPg_cre_sect_buf.pgc
Jason Alburger
HID/NAS/LAN Engineer
L3/ATO-E En Route Peripheral Systems Support
609-485-7225
jason.ctr.alburger@faa.gov writes: > I'm relatively new to database programming & I've inherited a system to > maintain that contains lots of embedded SQL. I'm attempting to port my C > source code from RH 7.2 (with ecpg 2.8.0) to Mandrake 10.0 (with ecpg > 4.1.1). ecpg 4.1.1 is generating an error which I did not get on the > RH7.2 system with ecpg 2.8.0....It's telling me I have a syntax error with > a "ROLLBACK RELEASE" (DbPg_cre_sect_buf.pgc:1334: ERROR: syntax error at or > near "RELEASE"). Here's a snippet of the code in error... I think RELEASE is now a reserved word (referring to savepoints) so you should probably just change the code to use 'ROLLBACK;'. -Doug
jason.ctr.alburger@faa.gov wrote:
> I'm relatively new to database programming & I've inherited a system to
> maintain that contains lots of embedded SQL. I'm attempting to port my C
> source code from RH 7.2 (with ecpg 2.8.0) to Mandrake 10.0 (with ecpg
> 4.1.1). ecpg 4.1.1 is generating an error which I did not get on the
> RH7.2 system with ecpg 2.8.0....It's telling me I have a syntax error with
> a "ROLLBACK RELEASE" (DbPg_cre_sect_buf.pgc:1334: ERROR: syntax error at or
> near "RELEASE"). Here's a snippet of the code in error...
> .
> .
> .
> 1320 /* Ignore termination signal (if rcvd) - terminating anyway
> */
> 1321 signal(SIGTERM, SIG_IGN);
> 1322
> 1323 /* send a message to the client that download has
> terminated abnormally */
> 1324 DbgS1(10, DBG_DRW_3, sqlca.sqlerrm.sqlerrmc);
> 1325 DbgI1(10, DBG_DRW_3, -sqlca.sqlcode);
> 1326
> 1327 EXEC SQL WHENEVER SQLERROR CONTINUE;
> 1328 EXEC SQL CLOSE cms_sec_curr;
> 1329
> 1330 if (fpa_curs)
> 1331 {
> 1332 DbPgCC_sector_assign_status ();
> 1333 }
> 1334 EXEC SQL ROLLBACK RELEASE;
> 1335
> 1336 DbgS1(11, DBG_DRW_3,
> 1337 "Closed Connection to the Database Due to Postgres
> Error");
Seems we had shift-reduce problems and had to remove this
Oracle-compatible syntax. In preproc.y I see:
/*
* for compatibility with ORACLE we will also allow the keyword RELEASE
* after a transaction statement to disconnect from the database.
*/
/* We cannot do that anymore since it causes shift/reduce conflicts. */
ECPGRelease: TransactionStmt RELEASE
and we commented out the ECPGRelease state. You can only use:
| RELEASE SAVEPOINT ColId
| RELEASE ColId
| ROLLBACK opt_transaction TO SAVEPOINT ColId
| ROLLBACK opt_transaction TO ColId
Sorry about that.
--
Bruce Momjian http://candle.pha.pa.us
SRA OSS, Inc. http://www.sraoss.com
+ If your life is a hard drive, Christ can be your backup. +