2
0
Эх сурвалжийг харах

fixed failure to lock object (most likely deleted)

Nicolas Cannasse 13 жил өмнө
parent
commit
5d8392b4d6

+ 2 - 1
std/sys/db/Manager.hx

@@ -232,7 +232,8 @@ class Manager<T : Object> {
 		s.add(" WHERE ");
 		addKeys(s, i);
 		// will force sync
-		unsafeObject(s.toString(),true);
+		if( unsafeObject(s.toString(),true) != i )
+			throw "Could not lock object (was deleted ?); try restarting transaction";
 	}
 
 	function objectToString( it : T ) : String {

+ 1 - 1
std/sys/db/Transaction.hx

@@ -27,7 +27,7 @@ package sys.db;
 class Transaction {
 
 	public static function isDeadlock(e : Dynamic) {
-		return Std.is(e,String) && (~/Deadlock found/.match(e) || ~/Lock wait timeout/.match(e));
+		return Std.is(e,String) && ~/try restarting transaction/.match(e);
 	}
 
 	private static function runMainLoop(mainFun,logError,count) {