PHP append to ClientDataSet CDS File

2019-05-09 11:02发布

I have an empty Delphi ClientDataSet CDS File setup with all the Columns/Headers/Datatypes that I need. I want to use PHP to append an associative array into CDS rows. Is this possible?

The array could simply be:

{
    1: {Name:Captain, Phone:18001234567}
    2: {Name:Jack, Phone:18009876543}
    3: {Name:Sparrow, Phone:18887892345}
}

I've selected PHP because I'm proficient with the language and my web server is a shared-linux host. Basically I cannot run Delphi here. I'm open to other options that could work in this environment. Thanks!

EDIT:

See the comments on this post for my resolution.

1条回答
在下西门庆
2楼-- · 2019-05-09 11:37

I recommend you to not write direct to the cds files.

Instead you can use a common xml for both applications (PHP and Delphi) and on the delphi side you load and save it using XML Transformation with TXmlTransformProvider and on the PHP side you just write it to the XML as you always do.

Take a look here on how to setup on delphi.

--UPDATE

If you realy need to change direct the cds file (using xml format) you can just add a new to the cds file considering the cds format is xml like this:

<?xml version="1.0" standalone="yes"?>  
<DATAPACKET Version="2.0">
    <METADATA>
        <FIELDS>
            <FIELD attrname="Name" fieldtype="string" WIDTH="24"/>
            <FIELD attrname="Capital" fieldtype="string" WIDTH="24"/>            
        </FIELDS>
        <PARAMS DEFAULT_ORDER="1" PRIMARY_KEY="1" LCID="2057"/>
    </METADATA>
    <ROWDATA>
        <ROW Name="Argentina" Capital="Buenos Aires"/>
        <ROW Name="Bolivia" Capital="La Paz"/>
        <ROW Name="Brazil" Capital="Brasilia"/>
        <ROW Name="Canada" Capital="Ottawa"/>        
        <ROW Name="United States of America" Capital="Washington"/> 
        //Add your new ROW tag here with your data       
    </ROWDATA>
</DATAPACKET>
查看更多
登录 后发表回答