Browse Source

Merge pull request #2692 from jasononeil/updatewithnocache

In sys.db.Manager.doUpdate(), if cache is null, update all fields
Cauê Waneck 10 years ago
parent
commit
51bdd96051
1 changed files with 6 additions and 2 deletions
  1. 6 2
      std/sys/db/Manager.hx

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

@@ -240,8 +240,11 @@ class Manager<T : Object> {
 			    fieldName = getFieldName(f);
 			var v : Dynamic = Reflect.field(x,fieldName);
 			var vc : Dynamic = Reflect.field(cache,name);
-			if( v != vc && (!isBinary(f.t) || hasBinaryChanged(v,vc)) ) {
+			if( cache == null || v != vc ) {
 				switch( f.t ) {
+				case DSmallBinary, DNekoSerialized, DLongBinary, DBytes(_), DBinary: 
+					if ( !hasBinaryChanged(v,vc) )
+						continue;
 				case DData:
 					v = doUpdateCache(x, name, v);
 					if( !hasBinaryChanged(v,vc) )
@@ -255,7 +258,8 @@ class Manager<T : Object> {
 				s.add(quoteField(name));
 				s.add(" = ");
 				getCnx().addValue(s,v);
-				Reflect.setField(cache,name,v);
+				if ( cache != null )
+					Reflect.setField(cache,name,v);
 			}
 		}
 		if( !mod )