Multiple transactions with OraSession.Assingconnect
Posted: Thu 28 Jun 2007 13:47
Hello !
I Have a problem with multiple transactions in use of 2 OraSession, since second OraSession AssignConnect the first OraSession.
the code I try:
OraSession1.AutoCommit:=False;
OraSession1.Connect;
Application.CreateForm(TDM, DM);
DM.OraSession1.AutoCommit:=False;
DM.OraSession1.AssignConnect(OraSession1);
OraSession1.StartTransaction;
OraQuery1.SQL.Text:='insert into teste (id, texto) values (1, ''rollback'')';
OraQuery1.ExecSQL;
DM.OraQuery1.SQL.Text:='insert into teste (id, texto) values (2, ''commit'')';
DM.OraQuery1.ExecSQL;
DM.OraSession1.commit;
OraSession1.Rollback;
I need that DM.OraSession1.commit doesn´t affect the OraSession1.
the result:
SQL> select * from teste;
ID TEXTO
---------- --------------------------------------------------
1 rollback
2 commit
the result I need:
SQL> select * from teste;
ID TEXTO
---------- --------------------------------------------------
2 commit
This sample are in
http://www.alternativasistemas.com.br/testecommit.zip
Create Script:
create table teste (
id number(9),
texto varchar2(50)
);
I Have a problem with multiple transactions in use of 2 OraSession, since second OraSession AssignConnect the first OraSession.
the code I try:
OraSession1.AutoCommit:=False;
OraSession1.Connect;
Application.CreateForm(TDM, DM);
DM.OraSession1.AutoCommit:=False;
DM.OraSession1.AssignConnect(OraSession1);
OraSession1.StartTransaction;
OraQuery1.SQL.Text:='insert into teste (id, texto) values (1, ''rollback'')';
OraQuery1.ExecSQL;
DM.OraQuery1.SQL.Text:='insert into teste (id, texto) values (2, ''commit'')';
DM.OraQuery1.ExecSQL;
DM.OraSession1.commit;
OraSession1.Rollback;
I need that DM.OraSession1.commit doesn´t affect the OraSession1.
the result:
SQL> select * from teste;
ID TEXTO
---------- --------------------------------------------------
1 rollback
2 commit
the result I need:
SQL> select * from teste;
ID TEXTO
---------- --------------------------------------------------
2 commit
This sample are in
http://www.alternativasistemas.com.br/testecommit.zip
Create Script:
create table teste (
id number(9),
texto varchar2(50)
);