tabs ↹ over ␣ ␣ ␣ spaces

by Jiří {x2} Činčura

Timeout for wait transactions in FirebirdClient

20 Oct 2008 1 mins .NET, Firebird

I have implemented new feature available from FB2.0, it’s timeout for wait transaction. It’s a nice feature, ’cause you can specify how long do you wanna wait before getting deadlock error. Thanks also to Dmitry Yemanov for debug (that also revealed couple of new bugs; now already fixed).

The current implementation is pretty straightforward. If you don’t specify timeout then it’s not used (which is important for ). Else (and you’re using wait transactions) is used. 😃 With this I redesigned a little bit the options for transactions. Now it’s more flexible and open for future improvements. Defining options for transaction is little bit different:

conn.BeginTransaction(new FbTransactionOptions() { TransactionBehavior = FbTransactionBehavior.Wait, WaitTimeout = 3 }))

Of course, you can create options object separately and put to method only variable. Changing old code to new one is just couple of rewriting, no new logic.

Enjoy!

Profile Picture Jiří Činčura is .NET, C# and Firebird expert. He focuses on data and business layers, language constructs, parallelism, databases and performance. For almost two decades he contributes to open-source, i.e. FirebirdClient. He works as a senior software engineer for Microsoft. Frequent speaker and blogger at www.tabsoverspaces.com.