I try to answer to both useful e-mails:
>>
The nested try..except is a bad practice
try
MyADOQuery.ExecSQL();
except // this is going to hide any failure
end;
Let any failure-exception to reach the outer except..end.
Otherwise your code will reach MyAdoConnection.CommitTrans()
even when the MyADOQuery.ExecSQL(); fails.
>>
Well, I believe in my case [until something different will be true],
I will catch, in nested try..except only the ADO exceptions.
I would like also to re-raise or not according to the specific ADO
exception,
but what [non-String] property of the exception to check to make a
selection?
=>
try
MyADOQuery.ExecSQL();
except on E : ?TADOException? (what type to use?)
if not VerifyPropertyOfAdoException(E) then
raise E;
end;
>>
http://msdn.microsoft.com/en-us/library/ms680895(VS.85).aspx
>>
>>
(from the referenced web page:)
Depending on the Connection object's Attributes property, calling either the
CommitTrans or RollbackTrans methods may automatically start a new
transaction. If the Attributes property is set to adXactCommitRetaining, the
provider automatically starts a new transaction after a CommitTrans call. If
the Attributes property is set to adXactAbortRetaining, the provider
automatically starts a new transaction after a RollbackTrans call.
>>
The default property of TADOConnection [I am using default] are: no
adXactCommitRetaining actived and no adXactAbortRetaining actived.
In fact, also if I did not know about these properties, I wrote the code
having in mind that a transaction is open only if I explictly call
BeginTrans().
Or, if I use an ExecSQL before to call BeginTrans(), I always think that a
mini-transaction is automatically open and then closed soon after
the ExecSQL work end.
Well, if you believe I should not use nested transactions, then I need to
avoid the transaction closure on an ExecSQL-ADOexception
and using that "VerifyPropertyOfAdoException".
If it is not possible, I believe I will try to understand in what cases the
ExecSQL can generate an exception [I know already the most important,
but no all cases] and then I will use:
//no try
if PreCheckQueryProperties(MyADOQuery) then
MyADOQuery.ExecSQL();
//no except
Mauro.
----- Original Message -----
From: "Theodoros Bebekis" <[email protected]>
To: <[email protected]>
Sent: Tuesday, February 10, 2009 12:33 PM
Subject: Re: [delphi-en] TADOQuery / TADOConnection
O/H Theodoros Bebekis Ýãñáøå:
> As for nested transactions through ADO and Delphi's ADO components...
> Avoid nested transactions if possible. ADO supports nested transactions
> but
> I think, not sure though and please correct me here if I'm wrong, there
> is a limit as to
> how many nesting levels are acceptable. I think is 6 or something.
check this out
http://msdn.microsoft.com/en-us/library/ms680895(VS.85).aspx
--
Regards
Theo
------------------------
Theo Bebekis
Thessaloniki, Greece
------------------------
The resource you are looking for has been removed,
had its name changed, or is temporarily unavailable.
------------------------
Greek_Delphi_Prog : a Delphi Programming mailing list in Greek at
http://groups.yahoo.com/group/Greek_Delphi_Prog
CSharpDotNetGreek : A C# and .Net mailing list in Greek language at
http://groups.yahoo.com/group/CSharpDotNetGreek
atla_custom : a Unisoft Atlantis Customization mailing list at
http://groups.yahoo.com/group/atla_custom
------------------------
------------------------------------
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [email protected]! Groups Links
----------
Questa email è stata verificata dal sistema centralizzato antivirus della
UniPlan Software
[Non-text portions of this message have been removed]
------------------------------------
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [email protected]! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/delphi-en/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/delphi-en/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[email protected]
mailto:[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/