  | | | RDBMSResolver does not process results_packet XML | RDBMSResolver does not process results_packet XML 2004-03-17 - By Jason Cowley
Back Well, after much decompiling and gnashing of teeth I figured it out. Yes, there is indeed a bug in the RDBMSResolver component.
Here are the details for those who are interested... The problem is in the RDBMSResolver's updateResultsToDataset() function (an internal, private function). In this function, the RDBMSResolver creates the DeltaPacket that contains updates from the server which is later bound to the DataSet. The third parameter of the DeltaPacket constructor (DeltaPacketImpl is the actual class used for the DeltaPacket) should be an object that holds a list of keys for the data. This list of keys allows the DataSet to figure out which items should be updated; it performs a sort on its data items using that list of keys. The resulting problem is that when the DataSet performs the sort using a null list of keys, it ends up updating the wrong items and usually deleting a few properties from those items.
Here is a fix that seems to work... Add a "reconcileUpdates" event listener to your RDBMSResolvers. The RDBMSResolver component dispatches that event just before it dispatches the "deltaPacketChanged" event which binds the DeltaPacket to the DataSet. In your listener object, add the required list of keys to the DeltaPacket.
The fix (see example code below) assumes of course that you've properly set up your RDBMSResolver by adding the key fields to the fieldInfo property.
I have not tested this on the "insert" and "delete" functions yet.
Hopefully Macromedia will issue a patch for this soon. Am I the only one on the planet using the RDBMSResolver?
~j.
code: __ ____ ____ ____ ____ ____ ____ ____ ____ ____ __
var RDBMSListener = new Object();
RDBMSListener .reconcileUpdates = function(evt) {
// Create a list of keys for this RDBMSResolver var listOfKeys = new Array(); var fieldIterator = evt.target.fieldInfo.getIterator(); while(fieldIterator.hasNext()) { var thisField = fieldIterator.next(); if (thisField.isKey) listOfKeys.push(thisField.fieldName); }
// Add list of keys to DeltaPacket evt.deltaPacket._keyInfo = {keyList: listOfKeys}; } __ ____ ____ ____ ____ ____ ____ ____ ____ ____ __
example XML: __ ____ ____ ____ ____ ____ ____ ____ ____ ____ __
<update_packet tableName="pages" nullValue="{_NULL_}" transID="IID96452074498"> <update id="IID70823342074"> <field name="id" type="Integer" oldValue="2684" key="true"/> <field name="itemNumber" type="Integer" oldValue="0" newValue="1" key="false"/> </update> </update_packet>
<results_packet transID="IID96452074498" nullValue="{_NULL_}"> <operation id="IID70823342074" op="update"/> <update> <field name="id" oldValue="2659" newValue="2659" key="true"/> <field name="itemNumber" newValue="0"/> </update> </results_packet> __ ____ ____ ____ ____ ____ ____ ____ ____ ____ ___
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- Supported by Fig Leaf Software =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- Be sure to check the archives and the wiki: http://chattyfig.figleaf.com/ =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:107246 =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- To unsubscribe send a blank e-mail to: Normal Mode: flashcoders-unsubscribe@(protected) Digest Mode: flashcoders-digest-unsubscrive@(protected)
|
|
 |