 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Henrique Guest
|
Posted: Tue Sep 21, 2004 1:47 pm Post subject: DBX Transaction control |
|
|
Hi,
I use D7, DbExpress for ASA (dbexpasa.dll). I want to send database my
commands to control transaction. It is necessary to create from
clientapplication a more detailed control. For example: I want to create
savepoint in transaction.
Ex:
sqlconnection1.ExecDirect( 'BEGIN TRANSACTION' );
{ some inserts, updates and deletes }
sqlconnection1.execDirect( 'savepoint 1' );
{ some inserts, updates and deletes }
if not exec ok then
sqlconnection1.execDirect( 'rollback to savepoint 1' );
sqlconnection1.ExecDirect( 'COMMIT TRANSACTION' );
The problem is if I use ExecDirect DBX starts e commits the statement. So I
canīt use this. How can I deactivate this? Or is there another way to
control transactions?
Tia
Henrique
|
|
| Back to top |
|
 |
Wayne Niddery [TeamB] Guest
|
Posted: Tue Sep 21, 2004 2:05 pm Post subject: Re: DBX Transaction control |
|
|
Henrique wrote:
| Quote: |
I use D7, DbExpress for ASA (dbexpasa.dll). I want to send database
my commands to control transaction. It is necessary to create from
clientapplication a more detailed control. For example: I want to
create savepoint in transaction.
sqlconnection1.ExecDirect( 'BEGIN TRANSACTION' );
{ some inserts, updates and deletes }
sqlconnection1.execDirect( 'savepoint 1' );
{ some inserts, updates and deletes }
if not exec ok then
sqlconnection1.execDirect( 'rollback to savepoint 1' );
sqlconnection1.ExecDirect( 'COMMIT TRANSACTION' );
The problem is if I use ExecDirect DBX starts e commits the
statement. So I canīt use this. How can I deactivate this? Or is
there another way to control transactions?
|
TSqlConnection already has methods for controlling transactions, there's no
need to use ExecDirect for this. You can also use a query component
(TSQLQuery or TSQLDataset) to execute a Savepoint and your other statements.
You do not mention whether this is a multitier app but you imply it is with
the term "clientapplication". If you are using DataSnap then, in general,
you should let it control transactions for you, but you could export a
method from there to handle savepoints, and for other cases where multiple
statements need to be executed in a single transaction.
--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: http://www.logicfundamentals.com/RADBooks.html
"True peace is not the absence of tension, but the presence of
justice." - Martin Luther King, Jr.
|
|
| Back to top |
|
 |
Henrique Guest
|
Posted: Tue Sep 21, 2004 10:01 pm Post subject: Re: DBX Transaction control |
|
|
"Wayne Niddery [TeamB]" <wniddery (AT) chaffaci (DOT) on.ca> escreveu na mensagem
news:4150351a$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Henrique wrote:
I use D7, DbExpress for ASA (dbexpasa.dll). I want to send database
my commands to control transaction. It is necessary to create from
clientapplication a more detailed control. For example: I want to
create savepoint in transaction.
sqlconnection1.ExecDirect( 'BEGIN TRANSACTION' );
{ some inserts, updates and deletes }
sqlconnection1.execDirect( 'savepoint 1' );
{ some inserts, updates and deletes }
if not exec ok then
sqlconnection1.execDirect( 'rollback to savepoint 1' );
sqlconnection1.ExecDirect( 'COMMIT TRANSACTION' );
The problem is if I use ExecDirect DBX starts e commits the
statement. So I canīt use this. How can I deactivate this? Or is
there another way to control transactions?
TSqlConnection already has methods for controlling transactions, there's
no
need to use ExecDirect for this. You can also use a query component
(TSQLQuery or TSQLDataset) to execute a Savepoint and your other
statements.
You do not mention whether this is a multitier app but you imply it is
with
the term "clientapplication". If you are using DataSnap then, in general,
you should let it control transactions for you, but you could export a
method from there to handle savepoints, and for other cases where multiple
statements need to be executed in a single transaction.
|
Hi Wayne,
I cant send a savepoint. I have tried it with ExecDirect and after DBX
committed. So my savepoint was lost. Savepoints are very usefull in some
transactions controls and I want it to be executed from my Server
Application (Yes, I use multitier).
Tia,
Henrique
|
|
| Back to top |
|
 |
Wayne Niddery [TeamB] Guest
|
Posted: Tue Sep 21, 2004 11:03 pm Post subject: Re: DBX Transaction control |
|
|
Henrique wrote:
| Quote: |
I cant send a savepoint. I have tried it with ExecDirect and after DBX
committed. So my savepoint was lost. Savepoints are very usefull in
some transactions controls and I want it to be executed from my Server
Application (Yes, I use multitier).
|
I do not know ASA and the syntax of savepoints, but assuming it is possible
to create savepoints via SQL statements, then you should be able to do so
through a either a query component. Perhaps someone else with ASA knowledge
will jump in here.
--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: http://www.logicfundamentals.com/RADBooks.html
"It is error alone which needs the support of government. Truth can
stand by itself." - Thomas Jefferson
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|