Subject | RE: [Firebird-net-provider] FW: [firebird-support] Transactions not working as expected.. |
---|---|
Author | Alan McDonald |
Post date | 2004-11-08T13:58:28Z |
> Ok back over here.. Carlos just says its uses ReadCommittedbefore you assign and execute xCmd4, have you tried either committing or
> (which I knew)
> and doesn't know why FB doesn't work as expected.. Any ideas?
>
> -----Original Message-----
> From: firebird-net-provider-admin@...
> [mailto:firebird-net-provider-admin@...] On
> Behalf Of Chad
> Z. Hower
> Sent: Sunday, November 07, 2004 7:42 PM
> To: firebird-net-provider@...
> Subject: RE: [Firebird-net-provider] FW: [firebird-support]
> Transactions not
> working as expected..
>
> :: Are you using the Firebird provider ??
>
> Ok I stripped out the layer that sits on top and here it is with straight
> FB.NET provider - same results.
>
> This just locks up:
>
> public void TestLock2() {
> FbConnection xDB1 = new
> FbConnection(ADOPlus.DBConnection.ConnectionString);
> xDB1.Open();
> FbConnection xDB2 = new
> FbConnection(ADOPlus.DBConnection.ConnectionString);
> xDB2.Open();
>
> FbTransaction xTx1 = xDB1.BeginTransaction();
> FbCommand xCmd1 = new FbCommand("Select * from \"Vendor\" where
> \"VendorID\" = 1", xDB1, xTx1);
>
> FbDataReader xReader1 = xCmd1.ExecuteReader();
> FbTransaction xTx2 = xDB2.BeginTransaction();
>
> FbCommand xCmd2 = new FbCommand("Select * from \"Vendor\" where
> \"VendorID\" = 1", xDB2, xTx2);
> FbDataReader xReader2 = xCmd2.ExecuteReader();
>
> FbCommand xCmd3 = new FbCommand("Update \"Vendor\" set \"Email\" =
> 'test' where \"VendorID\" = 1", xDB2, xTx2);
> xCmd3.ExecuteNonQuery();
>
> FbCommand xCmd4 = new FbCommand("Update \"Vendor\" set \"Email\" =
> 'test' where \"VendorID\" = 1", xDB1, xTx1); // Locks up here
> xCmd4.ExecuteNonQuery();
>
> xTx2.Commit();
>
> xTx1.Commit();
> }
>
rolling back xTx1?
Alan
> And this one executes fine - but it should throw a lock error as Iwhere do you expect this to throw a lock error?
> understand it:
>
> public void TestLock2() {
> FbConnection xDB1 = new
> FbConnection(ADOPlus.DBConnection.ConnectionString);
> xDB1.Open();
> FbConnection xDB2 = new
> FbConnection(ADOPlus.DBConnection.ConnectionString);
> xDB2.Open();
>
> FbTransaction xTx1 = xDB1.BeginTransaction();
> FbCommand xCmd1 = new FbCommand("Select * from \"Vendor\" where
> \"VendorID\" = 1", xDB1, xTx1);
>
> FbDataReader xReader1 = xCmd1.ExecuteReader();
> FbTransaction xTx2 = xDB2.BeginTransaction();
>
> FbCommand xCmd2 = new FbCommand("Select * from \"Vendor\" where
> \"VendorID\" = 1", xDB2, xTx2);
> FbDataReader xReader2 = xCmd2.ExecuteReader();
>
> FbCommand xCmd3 = new FbCommand("Update \"Vendor\" set \"Email\" =
> 'test' where \"VendorID\" = 1", xDB2, xTx2);
> xCmd3.ExecuteNonQuery();
>
> xTx2.Commit();
>
> FbCommand xCmd4 = new FbCommand("Update \"Vendor\" set \"Email\" =
> 'test' where \"VendorID\" = 1", xDB1, xTx1);
> xCmd4.ExecuteNonQuery();
>
> xTx1.Commit();
> }
>
>
>
Alan