shanker31 0 Newbie Poster

HEllo i want to implement..
To check if the transaction is complete.. if the transaction in complete then commit the transaction ..if not the transaction is rollback..
my DB table is : member(no int primary key,name varchar(255) int)engine=innodb;
My problem is if i press "crtl+C" the procedure is interupted so this should'nt update the table.. but i m having trouble with this.. when i press "ctrl+C" it takes the entered tuples in the table till i press "Ctrl+C"...


following is my procedure code:

create procedure insert_table(in last int,in name varchar(255))
begin
set autocommit=0;
set @x=0;
repeat
insert into member values(@x+1,name);
set @x=@x+1;
until @x > last
end repeat;
if @x=last then
commit;
elseif @x<=last then
rollback;
end if;
end //
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.