I.T. Discussion Community!
-Collapse +Expand
Delphi
Search Delphi Group:

Advanced
-Collapse +Expand Delphi To/From
To/FromCODEGuides
-Collapse +Expand Delphi Store
PRESTWOODSTORE

Prestwood eMagazine

April Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyPascal and Delphi Coding BoardDelphi Single User Apps Topic   Print This     

Rollback won't undo all changes.

Rollback won't undo all changes. in Delphi Single User Apps topic (part of our Pascal and Delphi Coding group).

Quick Search: Rollback   won't   changes   Rollback won't   Rollback won't undo   all changes  
Most Recent Post
PANTLORD
 (Inactive)
-- USA
Hi there,

Have a situation in my paradox database where I need to rollback single row inserts on 4 different tables if the insert fails on one. They all have indexes so this should be permitted I think. Here is the code I am using any idea why its not working? i.e. if there is an exception on the second insert the first still remains.

with OpTransactionsSQL do
begin
MASTDATA.VideoLinkDB.StartTransaction;
try
MYSQL := Format('INSERT INTO TRANSACTIONS(TRANSACTION_ID, MEMBER_ID, PRODUCT_ID, RENTAL_DATE, RENTAL_TIME, DUE_DATE, DUE_TIME) VALUES(%d, %d, %d, %s, %s, %s, %s)',[NEXTTRANSIDINT,CUSTIDINT,PRODIDINT,'"'+CURRDATE+'"','"'+CURRTIME+'"','"'+RETDATE+'"','"'+RETTIME+'"']);
Close;
SQL.Clear;
SQL.Add(MYSQL);
ExecSQL;
Close;
OpTransactionsSQL.DataSource := OpTransactionsDS;
MYSQL := Format('INSERT INTO OPERATOR_TRANSACTIONS(TRANSACTION_ID, OPERATOR_RENTAL_ID) VALUES(%d, %d)',[NEXTTRANSIDINT,OPIDINT]);
Close;
SQL.Clear;
SQL.Add(MYSQL);
ExecSQL;
Close;
MASTDATA.VideoLinkDB.Commit;
except
begin
MASTDATA.VideoLinkDB.Rollback; raise;
end
end;

Is it anything to do with using ExecSQl i.e. Passthrough SQL opposed to local transactions not really sure how this works.

Thanks
Niall
Trying to get a rollback on an exception to prevent
 Posted 19 years ago (Thread Starter)
Comment Quote
About PANTLORD -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #5302, No Replies Be the first!
Thread Started 2/15/2002 6:03:00 AM
View Counter=1667
Location=-- USA 
Joined=19 years ago   MB Posts=5  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1181A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #5302 Counter
1667
Since 4/2/2008

Follow PrestwoodBoards on: 


©1995-2021 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech