In MS SQL Server, I'm able to easily put multiple place claims right into a transaction, like so:
begin tran insert into mytable values (1, 2, 3) insert into mytable values (4, 5, 6) commit tran
I am attempting to perform the same factor in Firebird, however i can't determine the syntax. Searching for "Firebird transaction syntax" returns nothing helpful. I have found enough to understand that transaction support is available, but no good examples for using it right.
And So I figure I might as well request on here. Does anybody understand how to write a transaction using multiple card inserts for any Firebird database?
Firebird always uses transactions. The transaction is began the moment you are making a general change in the database and stays open for your session before you commit. Making use of your code, it's simply:
insert into mytable values (1, 2, 3); insert into mytable values (4, 5, 6); commit;
Matching @Allan's answer (that we upvoted, BTW), here's more information.
Whenever you do
begin tran in SQL Server, it doesn't imply that you are beginning the transaction now. You're already in transaction, as you are attached to the database! What
begin tran does indeed is disable the "auto-commit each and every statement", the default condition in SQL Server (unless of course otherwise specified).
commit tran commits and reverts the bond to "auto-commit each and every statement" condition.
In almost any database, when you're connected, you're already in transaction. This is the way databases are. For example, in Firebird, you are able to execute a commit or rollback even when only went a question.
Some databases and connection libs, within the other hands, let you apply the "auto-commit each and every statement" condition of connection, that is what SQL Server does. As helpful as which include may be, it's not so didactic and lead beginners to consider they're "not inside a transaction".