Hey everyone,
I have functions in place that will convert the results of sql queries into XML. However, I now want to be able to, using PHP, read in an XML document (that has nested SQL statements), execute those statements, and essentially replace the sql statement with the results.
(Just a note, using PostgreSQL)
For example:
<customers>
<customer>
<info>* from customer for where customer = 1</info>
<details>
<po>
<info>* from po join where customer = "master" customer</info>
</po>
<order_history>
<info>* from order_history where customer = "master" customer</info>
</order_history>
</details>
</customer>
<customer>
<info>* from customer for where customer = 2</info>
<details>
<po>
<info>* from po join where customer = "master" customer</info>
</po>
<order_history>
<info>* from order_history where customer = "master" customer</info>
</order_history>
</details>
</customer>
...
</customers>
I am confident in reading in the XML document and querying the DB with the SQL statements, however I am not to sure how to go about populating the results in the XML structure.
Some sort of text replacement? Or simultaneously rebuild a duplicate XML document with results? Any suggestions? Thanks...
Also, these queries are correlated in the sense that the sub-queries (or higher level queries) depend on the lower level queries...