NYCPHP Meetup

NYPHP.org

[nycphp-talk] RE: Sending OCI array through XML_RPC

Michael Lynch mlynch at icbf.com
Tue Jun 14 12:50:44 EDT 2005


Hi All

 

Could anyone adivise on the best way to send the results of an OCI query
through XML_RPC ?

 

I have a server side function that queries an Oracle database and sends
the results back via XML_RPC.

I can get it to work fine for single row result set by just binding out
variables but I'm finding mult-row result sets more difficult.

 

I'm using oci_fetch_array to put the results of my SQL query into an
array.

I then want to encapusulate this and send it as normal.

 

Below is my latest attempt.

 

$idbConn = oci_new_connect(DB_USER, DB_PSWD, DB_NAME);

                        $call = "SELECT col1, col2, col3 FROM mytable";

                                    

                        $Statement = @OCIParse($idbConn, $call);

                        @OCIExecute($Statement, OCI_DEFAULT);

                        

            

                        while($data_array=oci_fetch_array($Statement,
OCI_BOTH))

                        {

                                    

                                    foreach ($data_array as $key =>
$value)

                                    {

                                                $arData = new
XML_RPC_Value(array(

                                                new
XML_RPC_Value(array($key => new XML_RPC_Value($value)),

                                                 "struct")));

                                    }

 

                        }

 

                        $strucData = new
XML_RPC_Value($arData,'struct');

 

                        return new XML_RPC_Response($strucData);

 

All I get on debug is

---GOT---
HTTP/1.1 200 OK
Date: Tue, 14 Jun 2005 16:23:01 GMT
Server: Apache/1.3.33 (Unix) PHP/5.0.2
X-Powered-By: PHP/5.0.2
Content-Length: 302
Connection: close
Content-Type: text/xml
 
<?xml version="1.0"?>
<!-- DEBUG INFO:
 
0 - new XML_RPC_Value("63313842094", 'string') 
 
 
-->
<methodResponse>
<params>
<param>
<value><struct>
<member><name>me</name>
<value></value>
</member>
<member><name>mytype</name>
<value></value>
</member>
</struct></value>
</param>
</params>
</methodResponse>
---END---
---EVALING---[119 chars]---
new XML_RPC_Value(array('me' => new XML_RPC_Value("", 'string'),'mytype'
=> new XML_RPC_Value("", 'string')), 'struct');
---END---

 

 

Thanks

 

Mike

 

 

                        

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20050614/5b0ce544/attachment.html>


More information about the talk mailing list