|
From: <na...@us...> - 2010-09-12 06:20:58
|
Revision: 906
http://instantobjects.svn.sourceforge.net/instantobjects/revision/?rev=906&view=rev
Author: nandod
Date: 2010-09-12 06:20:52 +0000 (Sun, 12 Sep 2010)
Log Message:
-----------
* Fix for XML broker that would duplicate a file on disk if an object changed its Id.
Modified Paths:
--------------
trunk/Source/Brokers/XML/InstantXML.pas
Modified: trunk/Source/Brokers/XML/InstantXML.pas
===================================================================
--- trunk/Source/Brokers/XML/InstantXML.pas 2010-09-11 16:51:00 UTC (rev 905)
+++ trunk/Source/Brokers/XML/InstantXML.pas 2010-09-12 06:20:52 UTC (rev 906)
@@ -1272,6 +1272,12 @@
function TXMLFilesAccessor.WriteInstantObject(const AObject: TInstantObject;
const AStorageName: string; out AObjectUpdateCount: Integer): Boolean;
begin
+ // Get rid of the previous file if the object already existed and has
+ // changed Id.
+ if (AObject.PersistentId <> '') and AObject.IsIdChanged then
+ DeleteInstantObjectXmlFile(AObject,
+ GetObjectFileName(AStorageName, AObject.ClassName, AObject.PersistentId));
+
Result := InternalWriteInstantObject(AObject, AStorageName,
AObjectUpdateCount);
end;
|