Doubt in BeginTrans - RollBack - CommitTrans

0

Good morning,

I have some questions related to the Transactions control: BeginTrans - RollBack - CommitTrans.

I was currently using VB6 and the doubts arose: 1 - The Transactions controls when performing a RollBack, returns table structure?   * For example: Do I execute a DROP TABLE, CREATE TABLE in the same Transaction, and does an error occur, when executing ROllback, the deleted tables are restored / and the created ones are deleted?

2 - When opening a Transaction where all transactions are executed before they persist in bank (CommintTrans)? Any log files?

Thank you.

    
asked by anonymous 04.03.2015 / 14:22

1 answer

0

Ariel,

Not every command allows roolback, you should look at the documentation for the database you are using. For example, in MySQL:

link

  

CREATE TABLE and DROP TABLE statements do not commit a transaction if   the TEMPORARY keyword is used. (This does not apply to other   operations on temporary tables such as ALTER TABLE and CREATE INDEX,   which do cause a commit.) However, although no implicit commit occurs,   neither can the statement be rolled back, which means that the use of   such statements causes transactional atomicity to be violated. For   Example, if you use CREATE TEMPORARY TABLE and then roll back the   transaction, the table remains in existence.

This means that by default they commit, but can be bypassed by the TEMPORARY clause.

For the second question, I do not know transaction logs. The transaction itself consists of saving a state of your database, there would be no reason to have a log, at least from my point of view.

I hope I have helped!

    
04.03.2015 / 14:33