根據documents在Firebird中有四個事務隔離級別。不過,據我所知,在庫(TUIBTransaction)中沒有明確的隔離級別選擇,但是有很多事務選項可供選擇。我應該如何使用這些?有沒有文件?如何在UIB中使用Firebird事務隔離級別?
回答
這些選項將會改變隔離級別。正如@Arioch在他的簡短評論中所說,您可以更改隔離級別,更改類型爲TTransParams
的屬性Options
。這是一組TTransParam
如下。
// Transaction parameters
TTransParam = (
{ prevents a transaction from accessing tables if they are written to by
other transactions.}
tpConsistency,
{ allows concurrent transactions to read and write shared data. }
tpConcurrency,
{ Concurrent, shared access of a specified table among all transactions. }
{$IFNDEF FB_21UP}
tpShared,
{ Concurrent, restricted access of a specified table. }
tpProtected,
tpExclusive,
{$ENDIF}
{ Specifies that the transaction is to wait until the conflicting resource
is released before retrying an operation [Default]. }
tpWait,
{ Specifies that the transaction is not to wait for the resource to be
released, but instead, should return an update conflict error immediately. }
tpNowait,
{ Read-only access mode that allows a transaction only to select data from tables. }
tpRead,
{ Read-write access mode of that allows a transaction to select, insert,
update, and delete table data [Default]. }
tpWrite,
{ Read-only access of a specified table. Use in conjunction with tpShared,
tpProtected, and tpExclusive to establish the lock option. }
tpLockRead,
{ Read-write access of a specified table. Use in conjunction with tpShared,
tpProtected, and tpExclusive to establish the lock option [Default]. }
tpLockWrite,
tpVerbTime,
tpCommitTime,
tpIgnoreLimbo,
{ Unlike a concurrency transaction, a read committed transaction sees changes
made and committed by transactions that were active after this transaction started. }
tpReadCommitted,
tpAutoCommit,
{ Enables an tpReadCommitted transaction to read only the latest committed
version of a record. }
tpRecVersion,
tpNoRecVersion,
tpRestartRequests,
tpNoAutoUndo
{$IFDEF FB20_UP}
,tpLockTimeout
{$ENDIF}
);
由於Interbase 6.0代碼「opensourced」,API文檔沒有多大變化。所以,如果你想解釋其中的任何一個,你正在尋找的文檔在Interbase手冊中。
你可以讓他們在這裏http://www.firebirdsql.org/en/reference-manuals/
下面我引用安哈里森在此link到平時的選項的簡單說明使用:
isc_tpb_consistency可能會由於一個事實,即它的性能問題鎖定表並可能排除併發訪問。 isc_tpb_concurrency是Firebird的設計中心。讀者不需要 塊編寫者,編寫者不會阻止讀者,並且兩者都獲得數據庫的一致性 視圖。
isc_tpb_read_committed + isc_tpb_rec_version + isc_tbp_read_only給 不一致的結果,有時會產生上一滴 讀*一個錯誤,但不同於其它的模式,它不會阻止垃圾收集所以 它讀長時間運行的一個很好的方式交易,唐」不得不 得到「正確」的答案。
isc_tpb_read_committeed + isc_tpb_rec_version具有相同的性能 爲isc_tpb_concurrency,但得到不一致的結果 - 在同一個事務同一查詢 運行兩次可能會返回不同的行。
isc_tpb_read_committed + isc_tpb_no_rec_version + isc_tpb_wait比其它模式慢 ,因爲它會等待一個變化是 COMMITED而不是閱讀最新提交的版本。與isc_tpb_read_committed的所有變體 一樣,它不會產生一致的 結果。
isc_tpb_read_committed + isc_tpb_no_rec_version + isc_tpb_no_wait 給許許多多死鎖錯誤的,因爲每一次 遇到真實被更改的記錄的讀者,它返回一個錯誤。
注意:我希望你能看到,除了參數沒有同樣命名外,如果刪除「isc_tpb_」部分並不難理解。
- 1. SET事務隔離級別
- 2. EJB事務隔離級別
- 3. 事務中的隔離級別
- 4. Spring事務隔離級別vs數據庫隔離級別的優先級
- 5. 如何在SQLAlchemy for PostgreSQL中設置事務隔離級別?
- 6. SELECTs的事務隔離級別
- 7. MySQL事務隔離級別破壞?
- 8. 事務隔離級別數量龐大
- 9. NOLOCK與事務隔離級別
- 10. ActiveJob/Resque髒讀。事務隔離級別
- 11. 事務隔離級別問題
- 12. 事務,設置隔離級別
- 13. 如何將事務隔離級別設置爲SQLite中的ReadUncommitted?
- 14. 如何查看任意Oracle會話正在使用的事務隔離級別
- 15. NHibernate,我應該使用ReadCommitted還是ReadUncommited事務隔離級別?
- 16. 事務隔離級別REPEATABLE_READ使用休眠和jdbc
- 17. 使用Crystal Reports的SQL Server 2005:設置事務隔離級別
- 18. 如何設置Postgres數據源的事務隔離級別
- 19. 如何設置事務隔離級別的整數值
- 20. 如何設置事務隔離級別與DBUnit
- 21. EF4 Code First:如何創建事務並更改隔離級別
- 22. 金融應用程序中的事務隔離級別
- 23. 在基於Spring註釋的事務中設置隔離級別
- 24. 在Squeryl中設置事務隔離級別
- 25. 由事務隔離級別分隔的併發進程死鎖
- 26. 如何使用ActiveRecord連接設置事務隔離級別? [推薦寶石]
- 27. 如何在Sql Alchemy Python中爲MS SQL後端指定事務隔離級別
- 28. java.sql.Connection隔離級別
- 29. mysql隔離級別
- 30. 可序列化的事務隔離級別不適用於我
您鏈接到的文檔實際上並沒有說Firebird具有四個隔離級別,它表示SQL標準定義了四個,但沒有Firebird處理此方法的直接映射。 – 2013-02-19 11:10:06
你是對的。所以重新說一句:我正在尋找UIB中所有這些選項的文檔,以及它們與隔離級別的關係。 – Harriv 2013-02-19 11:20:18
引用UIB:'const TR默認:TTransParams = [tpConcurrency,tpWait,tpWrite]; TRSnapShot:TTransParams = [tpConcurrency,tpNowait]; TRReadCommitted:TTransParams = [tpReadCommitted,tpRecVersion,tpNowait]; TRReadOnlyTableStability:TTransParams = [tpRead,tpConsistency]; TRReadWriteTableStability:TTransParams = [tpWrite,tpConsistency];' – 2013-02-19 12:53:43