Interbase's transaction

xiaoxiao2021-03-06  45

If you use Sybase, MS SQL Server, you may be strange to interbase's transaction processing. How to transaction in InterBase? How to start, submit, and fall back? Where is the statement of transaction processing in InterBase? Especially in writing and using a stored procedure, many people have this doubt. In fact, as long as you understand the most critical point, Interbase's transaction is fully understood, that is: Interbase does not support embedded transaction processing, there is no statement for transaction processing. This is why Interbase's SQL language is not called T-SQL as other relational databases. You cannot perform transaction processing in the stored procedure and trigger in the stored procedure and trigger, like Sybase and other databases. Transaction processing is performed by subscription procedures, communication, commit trans (action). So how do INTEBASE work? In Interbase, all transactions, whether explicitly or implicit, all through the client, and submit either reply according to the case of the client operation. When the client initiates a SQL request, it also launches a transaction. If the statement is successful, InterBase will automatically submit the transaction; otherwise, if the statement does fail, InterBase retreats. In this sense, can I think that INTERBASE is a client transaction rather than a server-end transaction? no! Be sure, Interbase's business is inevitable and must be managed by the server side by the Interbase database engine operation, just the initiation of the InterBase transaction is initiated at the client, not on the server, which is the most essential. The execution of a SQL statement may nested or trigger execution of other SQL statements. These SQL statements will also start their own transactions, and we call the first start-up transaction as root transaction, other transactions called sub-transactions. In this way, root transactions, a sub-transaction has formed a transaction chain with a nested structure. Interbase is only submit transactions only when the operations corresponding to all links in the transaction chain (can not have any failure), interbase, as long as any of the transaction chains fail (although other links are successful), InterBase Retreat all business. Interbase will never perform some transactions. This is the operational mechanism of Interbase, which is the Atterbase emphasizes atomic transaction. Understand this, let's take a look at Interbase's stored procedures and triggers. The stored procedure is executed by the client, and the client performs a stored procedure while also launching a transaction. It is not a hypothesis that this transaction is the root transaction of the stored procedure. Any SQL statement in the stored procedure will start the corresponding child transaction. These sub-transactions are nested in the above root transactions to form a transaction chain. According to the previous description, whether it is a call operation corresponding to the root transaction, or the operation in the stored procedure of the child transaction, the InterBase retires all the transactions in the transaction chain, so that there is no substantive change to the database. Only when all operations are successfully implemented, InterBase will submit all transactions in the transaction chain to make substantive changes to the database. The trigger is excited because the client performs insertion, changes, delete, etc. The client will definitely start the corresponding transaction when performing insertion, changes, deletion, etc., and it is assumed that the root transaction is assumed, and the sub-transaction that is started by the SQL statement operation in the trigger they excited is nestled in the root transaction, thus Also form a transaction chain.

转载请注明原文地址:https://www.9cbs.com/read-79845.html

New Post(0)