Server 6: Shaped Resultsets

<< Click to Display Table of Contents >>

Navigation:  Examples > Server >

Server 6: Shaped Resultsets

Previous pageReturn to chapter overviewNext page

This sample shows the same data as the Relation window, but uses a different approach, using the MsDataShape provider and the AdoShapeServer classes. In this case the SetRelation will take the name of the column that contains the child recordset


GLOBAL goConn AS AdoConnection


CLASS PubServer INHERIT AdoShapeServer

 EXPORT oTitles AS AdoShapeServer

METHOD Init() CLASS PubServer

 // Create a connection with the MsDataShape provider to the Pubs database


 goConn   := AdoConnection{}

 goConn:Provider := "MSDataShape"

 goConn:Open ( "Data Provider=SQLOLEDB;" + ;


 // Set the, so Vo2Ado can use the connection to get information

 // about the last errors that occurred



 // Create a shaped recordset

 SUPER:init ( "SHAPE  {select * from publishers} APPEND " + ;

 " ({select * from titles } " + ;

 " RELATE pub_id TO pub_id) AS chapTitles", ;


 SELF:oTitles := SELF:SetRelation(#chapTitles)