Subject Transactions not working as expected..
Author Chad Z. Hower aka Kudzu
I created two transactions and tried to get a lock error so I could see how
to isolate it. ` --> ", it's a trick I use in C# since " is the string
literal and \" really mucks up the code. Transactions are ReadCommitted.

First I tried this:

public void TestLock() {
ADOPlus.DBConnection xDB1 = new ADOPlus.DBConnection();
ADOPlus.DBConnection xDB2 = new ADOPlus.DBConnection();
using (ADOPlus.Transaction xTx1 = new ADOPlus.Transaction(xDB1)) {
xDB1.Execute("Select * from `Vendor` where `VendorID` = 1");
using (ADOPlus.Transaction xTx2 = new ADOPlus.Transaction(xDB2)) {
xDB2.Execute("Select * from `Vendor` where `VendorID` = 1");
xDB2.Execute("Update `Vendor` set `Email` = 'test' where
`VendorID` = 1");
} // xTx2 is committed here
xDB1.Execute("Update `Vendor` set `Email` = 'test2' where `VendorID`
= 1");
} // xTx1 is committed here
}

I expected
xDB1.Execute("Update `Vendor` set `Email` = 'test2' where `VendorID`
= 1");
To throw an exception since the xTx2 updated since I started my transaction
- but it didn't. In fact after viewing the table it does have test2, not
test.

So then I tried this:

public void TestLock() {
ADOPlus.DBConnection xDB1 = new ADOPlus.DBConnection();
ADOPlus.DBConnection xDB2 = new ADOPlus.DBConnection();
using (ADOPlus.Transaction xTx1 = new ADOPlus.Transaction(xDB1)) {
xDB1.Execute("Select * from `Vendor` where `VendorID` = 1");
using (ADOPlus.Transaction xTx2 = new ADOPlus.Transaction(xDB2)) {
xDB2.Execute("Select * from `Vendor` where `VendorID` = 1");
xDB2.Execute("Update `Vendor` set `Email` = 'test' where
`VendorID` = 1");
xDB1.Execute("Update `Vendor` set `Email` = 'test2' where
`VendorID` = 1");
} // xTx2 is committed here
} // xTx1 is committed here
}

This one I expected a deadlock error. But it just stuck.... In fact I waited
well over a minute and still nothing...

????