开发者

Limit on clientdataset columns and size

开发者 https://www.devze.com 2022-12-17 12:50 出处:网络
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?

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;y=82&amp;q=85&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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号