[fpc-pascal] Patch: new XML export for FCL-DB ready for inclusion, issue 19790 - includes Delphi Clientdataset
Michael Van Canneyt
michael at freepascal.org
Mon Aug 15 11:25:53 CEST 2011
On Mon, 15 Aug 2011, Reinier Olislagers wrote:
> On 28-7-2011 9:24, michael.vancanneyt at wisa.be wrote:
>> On Thu, 28 Jul 2011, Reinier Olislagers wrote:
>>> On 27-7-2011 20:52, michael.vancanneyt at wisa.be wrote:
>>> Code like
>>>
>>> ftWideString: //fixed length or at least max length string
>>> begin
>>> TDOMElement(ColumnNode).SetAttribute('fieldtype', 'string');
>>> TDOMElement(ColumnNode).SetAttribute('WIDTH',
>>>
>>> UTF8Decode(string(ExportFields.Fields[ItemCounter].Field.Size)));
>>> end;
> Regarding the snippet above: for Unicode-enabled Delphis, using
> Clientdataset savetofile as UTF8-based XML (dfXMLUTF8), what do I need
> to output for a ftString:
> - Field.Size (number of characters in string)
> - Field.DataSize (number of bytes in string field)
>
> As Michael indicated, it probably is Field.Size, but I'd like to have
> that confirmed. (Can't seem to find any documentation on ClientDataset
> XML format on Embarcadero's Delphi help at
> http://docwiki.embarcadero.com/VCL/en/DBClient.TCustomClientDataSet.SaveToFile)
I created a dataset with 2 fields. A ftString field with size 33, and a ftWideString field with size 44.
Based on the following output from SaveToFile, I would say that you'll need to put
Size*SizeOf(CharTypeUsedInfield), which should be DataSize.
Michael.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DATAPACKET Version="2.0">
<METADATA>
<FIELDS>
<FIELD attrname="stringveld" fieldtype="string" WIDTH="33"/>
<FIELD attrname="WideStringVeld" fieldtype="string.uni" WIDTH="44"/>
</FIELDS>
<PARAMS/>
</METADATA>
<ROWDATA>
</ROWDATA>
</DATAPACKET>
More information about the fpc-pascal
mailing list