我有適當的函數將sql查詢的結果轉換爲XML。但是,我現在希望能夠使用PHP讀取XML文檔(具有嵌套的SQL語句),執行這些語句,並基本上用結果替換sql語句。用查詢結果替換XML中的SQL語句
(剛一說明,使用PostgreSQL)
例如:
<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>
我相信在讀取XML文檔中,並與SQL語句查詢數據庫,但我不肯定如何去填充XML結構中的結果。
某種文本替換?或者同時重建一個帶有結果的重複XML文檔?有什麼建議麼?謝謝...
而且,這些查詢都是在這個意義上,子查詢(或更高級別的查詢)取決於下級查詢相關...