tags:

views:

95

answers:

1

Hi,

Is there a limit on the number of columns a client dataset can have and also is the limit on the size of the columns?

We have an app that loads the client dataset from an xml file (it is not a file on disk but an xml block in memory which is loaded) and we found that if we set the width on one of the columns to over a 1000, then we would get some obscure access violation (sometimes the application would just hang).

JD.

Ps. As far I can recall we are still using the client dataset which came with delphi 2006.

Okay, some code:

We have an xml block of data that is in this format: string xmlDataSet=

<METADATA>
    <FIELDS>
        <FIELD attrname="f:CNAME" fieldtype="string" width="50"/>
        <FIELD attrname="f:CTITL" fieldtype="string" width="500"/>
        <FIELD attrname="f:ID" fieldtype="string" width="250"/>
        <FIELD attrname="f:CREDT" fieldtype="string" width="250"/>
        <FIELD attrname="f:HEADT" fieldtype="string" width="500"/>
        <FIELD attrname="f:BODYT" fieldtype="string" width="500"/>
        <FIELD attrname="f:DATE1" fieldtype="string" width="500"/>
        <FIELD attrname="f:TIME1" fieldtype="string" width="500"/>
        <FIELD attrname="f:DATE2" fieldtype="string" width="500"/>
        <FIELD attrname="f:TIME2" fieldtype="string" width="500"/>
        <FIELD attrname="f:IMG_1" fieldtype="string" width="500"/>
        <FIELD attrname="f:IMG_2" fieldtype="string" width="500"/>
        <FIELD attrname="f:IMG_3" fieldtype="string" width="500"/>
        <FIELD attrname="f:VID_1" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_A" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_B" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_C" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_D" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_E" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_F" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_G" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_H" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_I" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_J" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_K" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_L" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_M" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_N" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_O" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_P" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_Q" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_R" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_S" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_T" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_U" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_V" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_W" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_X" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_Y" fieldtype="string" width="500"/>
        <FIELD attrname="f:FLD_Z" fieldtype="string" width="500"/>
    </FIELDS>
</METADATA>
<ROWDATA>
    <ROW f:DATE2="" f:TIME2="" f:IMG_2="" f:IMG_3="" f:VID_1="" f:FLD_A="" f:FLD_B="" f:FLD_C="" f:FLD_D="" f:FLD_E="" f:FLD_F="" f:FLD_G="" f:FLD_H="" f:FLD_I="" f:FLD_J="" f:FLD_K="" f:FLD_L="" f:FLD_M="" f:FLD_N="" f:FLD_O="" f:FLD_P="" f:FLD_Q="" f:FLD_R="" f:FLD_S="" f:FLD_T="" f:FLD_U="" f:FLD_V="" f:FLD_W="" f:FLD_X="" f:FLD_Y="" f:FLD_Z="" f:CNAME="YahooNewsTopStories" f:CTITL="Yahoo! News: Top Stories" f:ID="ap/20100119/cb_haiti_earthquake" f:HEADT="Haiti chaos hampers aid delivery; death toll rises (AP)" f:BODYT="AP - Relief workers say pockets of violence in Haiti's devastated capital are hindering a slow increase in much-needed aid delivery, and some residents have banded together to protect the few possessions they have left." f:IMG_1="http://d.yimg.com/a/p/ap/20100118/capt.cb4c93423c284ca985dd02fd38d283e4.haiti_earthquake_xgb107.jpg?x=130&amp;amp;y=82&amp;amp;q=85&amp;amp;sig=gRxfiZPe6KlqoVNPtadFzQ--" flab:DATE1="Publication Date" f:CREDT="(AP)" f:TIME1="13:03:59" f:DATE1="mardi 19 janvier 2010"/>
    <ROW f:DATE2="" f:TIME2="" f:IMG_2="" f:IMG_3="" f:VID_1="" f:FLD_A="" f:FLD_B="" f:FLD_C="" f:FLD_D="" f:FLD_E="" f:FLD_F="" f:FLD_G="" f:FLD_H="" f:FLD_I="" f:FLD_J="" f:FLD_K="" f:FLD_L="" f:FLD_M="" f:FLD_N="" f:FLD_O="" f:FLD_P="" f:FLD_Q="" f:FLD_R="" f:FLD_S="" f:FLD_T="" f:FLD_U="" f:FLD_V="" f:FLD_W="" f:FLD_X="" f:FLD_Y="" f:FLD_Z="" f:CNAME="YahooNewsTopStories" f:CTITL="Yahoo! News: Top Stories" f:ID="ap/20100119/us_marriage_economics" f:HEADT="Report: More men get economic boost from marriage (AP)" f:BODYT="AP - Historically, marriage was the surest route to financial security for women. Nowadays it's men who are increasingly getting the biggest economic boost from tying the knot, according to a new analysis of census data." f:IMG_1="" flab:DATE1="Publication Date" f:CREDT="" f:TIME1="13:03:59" f:DATE1="mardi 19 janvier 2010"/> etc...LOTS MORE ROWS.

With this xml block in memory, we load as follows:

FClientDataSet := TClientDataSet.Create(nil); TransformedXSLTStream := TStringStream.Create(xmlDataSet); (from above) ClientDataSet.LoadFromStream(TransformedXSLTStream); TransformedXSLTStream.Free; ClientDataSet.First;

Now if I set width above to 1000, then I get an Access violation (read addresss xxx etc) on the LoadStream.

+1  A: 

My guess would be that it is memory related or a hard coded limit. If you trace the component you should be able to find the exception rather easily. I would start with loadstream. Also you might try it with test data that you know is clean. I have had situations while parsing XML and other similar formats where the data had "invalid" characters which would cause the application to crash. Ansi/unicode did it for me too in of all things a simple text file.

General Jackson Tackett
Thanks General. The strange thing is sometimes the loading works fine and then after all the code has executed, I get an exception being raised. The exception appears in SysUtils where a control is being painted which makes it even more obscure.
JD
Now that's a clue. What kind of component are you using? How many columns trigger this error?
Leonardo Herrera
We are using the delphi 2006 clientdataset. I am trying to trace into it but cannot see where or how the xml block is loaded. The results seem to vary in terms of the number of columns, initially 40 did it but now I am thinking maybe there is somethin in the XML data that is causing the problem.
JD
@General : With my current tests the exception does not seem to occur in the loadFromStream method but when some controls are being painted. I have also found that that we changed the msxml2_tlb, can this be causing the problem? I cannot seem to find where in the clientDataSet loadfromStream method the xml datapacket is being loaded? Is it possible to rebuild the clientdataset with a different version of msxml2_tlb?
JD
After 3 days of trying to get this working, we moved over from delphi 2006 to codegear 2007 and the random memory corruption av has disappeared. Thanks for all those that have helped. My question now is (for future reference), how can I debug the clientdataset on 2006?
JD
Well I would have tried using a different component or locking the controls while accessing the clientdataset. I forget the syntax but there is a way.. lockwindowupdates I think..?
General Jackson Tackett