Icon View Incident Report

Serious Serious
Reported By: Ole Willy Tuv
Reported On: 3/7/2007
For: Version 1.01 Build 1
# 2263 PREPARE Statements Without UNPREPARE Statements Causes Resource Leak

1) Create the following procedure

2) Execute the procedure in EDB Manager

3) Execute the procedure a second time:

ElevateDB Error #300 Cannot lock table t1 for exclusive access.

create procedure sp_test()
begin
 declare stmt statement;

 --delete table t2 if exists
 prepare stmt from
 '
   select 1
   from information.tables
   where upper(name) = ''T2''
 ';
 execute stmt;
 if (rowsaffected(stmt) = 1) then
   execute immediate 'alter table t2 drop constraint fk_t2'; --workaround
   execute immediate 'drop table t2';
 end if;

 --delete table t1 if exists
 prepare stmt from
 '
   select 1
   from information.tables
   where upper(name) = ''T1''
 ';
 execute stmt;
 if (rowsaffected(stmt) = 1) then
   execute immediate 'drop table t1';
 end if;

 --table t1
 execute immediate
 '
   create table t1
   (
     pkey integer not null,
     constraint pk_t1 primary key (pkey)
   )
 ';
 prepare stmt from 'insert into t1 (pkey) values (?)';
 execute stmt using 1;

 --table t2
 execute immediate
 '
   create table t2
   (
     pkey integer not null,
     fkey integer,
     constraint pk_t2 primary key (pkey),
     constraint fk_t2 foreign key (fkey) references t1 (pkey)
   )
 ';
 prepare stmt from 'insert into t2 (pkey,fkey) values (?,?)';
 execute stmt using 100,1;

 unprepare stmt;
end



Comments Comments
This issue affects all routines, which includes jobs, triggers, procedures, and functions.


Resolution Resolution
Fixed Problem on 3/8/2007 in version 1.02 build 1


Products Affected Products Affected
ElevateDB Additional Software and Utilities
ElevateDB VCL Client-Server
ElevateDB VCL Client-Server with Source
ElevateDB VCL Standard
ElevateDB VCL Standard with Source
ElevateDB VCL Trial

Image