5

ドキュメントによると、Firebird には 4 つのトランザクション分離レベルがあります。ただし、私の知る限り、uibライブラリ (TUIBTransaction) には明示的な分離レベルの選択はありませんが、トランザクションのオプションはたくさんあります。それらをどのように使用すればよいですか?ドキュメントはどこかにありますか?

4

1 に答える 1

2

これらの一連のオプションは、分離レベルを変更するものです。Options@Arioch が彼のコンパクトなコメントで述べたように、 typeのプロパティを変更して分離レベルを変更できますTTransParams。以下のようなセットです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 のコードが「オープンソース化」されて以来、API のドキュメントはあまり変更されていません。したがって、それらのいずれかについての説明が必要な場合は、探しているドキュメントが Interbase のマニュアルにあります。

ここから入手できますhttps://www.firebirdsql.org/en/reference-manuals/

以下では、このリンクで Ann Harrison を引用して、使用される通常のオプションに関する簡単な説明を示します。

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 と同じですが、一貫性のない結果が得られます。同じトランザクションで同じクエリを 2 回実行すると、異なる行が返される場合があります。

isc_tpb_read_committed + isc_tpb_no_rec_version + isc_tpb_wait は、最新のコミットされたバージョンを読み取るのではなく、変更がコミットされるのを待つため、他のモードよりも遅くなります。isc_tpb_read_committed のすべてのバリアントと同様に、一貫した結果が得られません。

isc_tpb_read_committed + isc_tpb_no_rec_version + isc_tpb_no_wait では、リーダーが変更中のレコードに遭遇するたびにエラーが返されるため、多くのデッドロック エラーが発生します。

注: パラメータの名前が同じではないことに加えて、「isc_tpb_」の部分を削除してもそれほど難しくないことがわかると思います。

于 2013-08-07T20:09:55.430 に答える