Progress
Open Client
Developer’s Guide
Passing a TEMP-TABLE OR TABLE-HANDLE As an Input Parameter
To pass an input parameter, you must create an object whose methods the proxy can call to obtain the data. In a Visual Basic program, you can provide one of three types of objects:
Whatever mechanism you use, the proxy determines what kind of object you are passing and calls the appropriate methods to access it.
NOTE: This section also applies to the input side of input/output TEMP-TABLE parameters.The following sections provide information about:
Choosing an Object Type to Pass
If you have access to ADO technology, this is the most flexible mechanism, because you can obtain an ADO Recordset in two ways:
If you do not have access to ADO technology, and the input data resides in a local database, using a DAO Recordset is your best alternative. Otherwise, you must use the
IClientTempTable
interface.The source object (the DAO, ADO, or
IClientTempTable
object) is not passed directly as a parameter. Instead, the client application creates aProTempTable
object and sets itsDataSource
property to one of these source objects.The implementation of an Automation object that supports the
IClientTempTable
interface can obtain the data in whatever way is necessary. For example, it might read the data from an ActiveX Grid control, obtain it from an array variable or load it from of a file. You can find an example of how to implement this interface installed with the Open Client Runtime and located in the directory:Progress-Install-Directory
\src\samples\open4gl\IClientTempTable.
The
IClientTempTable
interface has the following methods:
Changes the current record to the next row of the Recordset. The current record is initialized to the record before the first record of the set. Therefore, the first time
MoveNext()
is called it moves to the first record. moreRecs is an output parameter that is set to FALSE when the end of the Recordset is reached.NOTE: Make sure the result set cursor is positioned before the first row if you plan to pass the InputResultSet as an input parameter, and you want the receiving context to have access to all rows from the beginning of the TEMP-TABLE. Only rows after the current cursor position are passed to the AppServer.
Gets the value for the column specified with fldIndex,a 1-based index. This must map to the order in which the fields are defined in the 4GL TEMP-TABLE. For input, a 4GL array field is viewed as a flattened set of columns (see "Programming Concepts"). This is generally convenient in VB because the likely data sources for input Recordsets (such as, grids, arrays, or Access databases) do not themselves support array fields.
Input TEMP-TABLE Parameter Examples For ActiveX
Example 7–1 shows a sample of VB code that takes a TEMP-TABLE input parameter as an ADO Recordset.
Example 7–1: ActiveX TEMP-TABLE Input Parameter Using ADOExample 7–2 shows a sample of VB code that takes a TEMP-TABLE input parameter as a DAO Recordset.
Example 7–2: ActiveX TEMP-TABLE Input Parameter Using DAOExample 7–3 shows a sample of VB code that takes a TEMP-TABLE input parameter as an
IClientTempTable
Automation object. In this example,vbtt.VBTempTable
is an object that implementsIClientTempTable
.NOTE: You must implement your ownIClientTempTable
object similar to the exampleVBTempTable
class installed with the Open Client Runtime (see "Choosing an Object Type to Pass" earlier in this section).
Example 7–3: ActiveX TEMP-TABLE Input Parameter Using IClientTempTable
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |