Jump to content
Sign in to follow this  
butterfly

Autoit - Firebird sql Combo, Return data as csv instead of XML

Recommended Posts

butterfly

have been far far in some project with another person, and the project is closed to being finished finished.

I am using Autoit in combination with FIREBIRD sql database

I use the firebird.au3 include and .dll

fbdll4vb20.dll

libmysql.dll

etc

http://fbdll4vb.sourceforge.net/

he / we wrote tons of queries and tons more to go

 

and everything is working properly

but the results from the database comes as XML code such as

<results><metadata><fields><name value="NAME" alias="NAME" type="5" size="80"       scale="0" /><name value="SETCODE" alias="SETCODE" type="5" size="8" scale="0" /><name value="NORMALBUY" alias="NORMALBUY" type="7" size="4" scale="3" /><name value="NORMALSELL" alias="NORMALSELL" type="7" size="4" scale="3" /><name value="FOILBUY" alias="FOILBUY" type="7" size="4" scale="3" /><name value="FOILSELL" alias="FOILSELL" type="7" size="4" scale="3" /><name value="RARITY" alias="RARITY" type="5" size="6" scale="0" /><name value="CARDNO" alias="CARDNO" type="5" size="6" scale="0" /><name value="NORMALMAX" alias="NORMALMAX" type="7" size="4" scale="0" /><name value="NMAXSTOCK" alias="NMAXSTOCK" type="7" size="4" scale="0" /><name value="FOILMAX" alias="FOILMAX" type="7" size="4" scale="0" /><name value="FMAXSTOCK" alias="FMAXSTOCK" type="7" size="4" scale="0" /><name value="NWISHPRIO" alias="NWISHPRIO" type="7" size="4" scale="0" /><name value="FWISHPRIO" alias="FWISHPRIO" type="7" size="4" scale="0" /><name value="NCATID" alias="NCATID" type="7" size="4" scale="0" /><name value="FCATID" alias="FCATID" type="7" size="4" scale="0" /><name value="NCHECKSUM" alias="NCHECKSUM" type="5" size="40" scale="0" /><name value="FCHECKSUM" alias="FCHECKSUM" type="5" size="40" scale="0" /><name value="REMARKS" alias="REMARKS" type="5" size="120" scale="0" /></fields></metadata><data><row num="1" ><NAME>Duty-Bound Dead                                                                 </NAME><SETCODE>M13     </SETCODE><NORMALBUY>1.e-003</NORMALBUY><NORMALSELL>4.e-003</NORMALSELL><FOILBUY>3.e-003</FOILBUY><FOILSELL>1.5e-002</FOILSELL><RARITY>C     </RARITY><CARDNO>92    </CARDNO><NORMALMAX>12</NORMALMAX><NMAXSTOCK>12</NMAXSTOCK><FOILMAX>0</FOILMAX><FMAXSTOCK>0</FMAXSTOCK><NWISHPRIO>20</NWISHPRIO><FWISHPRIO>20</FWISHPRIO><NCATID>45504</NCATID><FCATID>45505</FCATID><NCHECKSUM>3063484788-4270110158                   </NCHECKSUM><FCHECKSUM>3063484788-4041915094                   </FCHECKSUM><REMARKS>Perfect                                                                                                                 </REMARKS></row></data></results>

then i just need to do this 40.000x on a 40.000 return query

$result = stringreplace($result,"<![CDATA[","")
    $result = stringreplace($result,"]]>","")
    $aName = _GetXML($result, "NAME")
    $aSetcode = _GetXML($result, "SETCODE")
    $aRarity = _GetXML($result, "RARITY")
    $aPremium = _GetXML($result, "PREMIUM")
    $aBuy = _GetXML($result, "BUY")
    $aSell = _GetXML($result, "SELL")
    $aStock = _GetXML($result, "STOCK")
    local $alist[$rcount+1][7]
    $alist[0][0] = $rcount
    for $z = 1 to $rcount
        $alist[$z][0] = StringStripWS($aName[$z],3)
        $alist[$z][1] = StringStripWS($aSetcode[$z],3)
        $alist[$z][2] = StringStripWS($aRarity[$z],3)
        $alist[$z][3] = StringStripWS($aPremium[$z],3)
        $alist[$z][4] = nume(StringStripWS($aBuy[$z],3))
        $alist[$z][5] = nume(StringStripWS($aSell[$z],3))
        $alist[$z][6] = StringStripWS($aStock[$z],3)
    next

as above

Such  work i am trying to cut out  -- I do not mind the work but it starts slowing down my program(s)

but I am only interested in my data being returned as .csv but with my own defined seperator ( ; <-- as example)

Duty-Bound_Dead;M13;0.001;0.004;0.003;0.015;C;922;2;1;0;0;20;20;45504,45505;3063484788-4270110158;3063484788-4041915094;Perfect

is this possible?

  

 

Is this Possible? I have quite low technical understanding but I am hoping for a savior here

Edited by butterfly

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×