Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
multiple rows return ?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
Alex  
View profile   Translate to Translated (View Original)
 More options 4 July, 18:07
From: Alex <alexanderli...@gmail.com>
Date: Sat, 4 Jul 2009 10:07:37 -0700 (PDT)
Local: Sat 4 July 2009 18:07
Subject: multiple rows return ?
Hi all,

I have not found any examples that handle multiple rows of data
returned from database. Anyone can please show me an example? What I
have is this

I have a service that returns multiple rows of result from a database
query, for example

SELECT employeeID, employeeName, employeeAddress FROM EMPLOYEE;

Say the returned result is

1 | John | One Road
2 | Mark | Two Road
3 | Luke | Three Road

How can I represent that in xsd and how those results are going to put
into the array to return the result from the services and at the
client side getting and displaying these results?

Thanks in advance for any help.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dalibor Andzakovic  
View profile   Translate to Translated (View Original)
 More options 5 July, 21:40
From: Dalibor Andzakovic <Dalibor.Andzako...@swerve.co.nz>
Date: Mon, 6 Jul 2009 08:40:18 +1200
Local: Sun 5 July 2009 21:40
Subject: RE: [phpsoa] multiple rows return ?
One way you could achieve this is:

XSD:

<xsd:complexType name="EmployeeList">
<xsd:sequence>
        <xsd:element name="Employee" type="EmployeeList_T" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="EmployeeList_T">
<xsd:sequence>
        <xsd:element name="employeeID" type="xsd:integer" />
        <xsd:element name="employeeName" type="xsd:string" />
        <xsd:element name="employeeAddress" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>

PHP

$sth = $this->PDO->prepare("SELECT employeeID, employeeName, employeeAddress FROM EMPLOYEE;");
$sth->execute();

$employeeList = SCA::createDataObject('your/xsd/namespace', 'EmployeeList');            

while($row = $sth->fetch(PDO::FETCH_OBJ)){                  
        $employee = $employeeList->createDataObject('Employee');
        $employee->employeeID = $row->employeeID;
        $employee->employeeName = $row->employeeName;
        $employee->employeeAddress = $row->employeeAddress;

}

There is probably a nicer way to merge the resulting row object into the SDO object, but you get the idea.

HTH

dali


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google