skip to main content
OpenEdge Development: ADM and SmartObjects
Developing Your Application's Business Logic : Running SmartDataObjects from a non-Progress client
 
Running SmartDataObjects from a non-Progress client
The SmartDataObject has an extensive API. You can access many of its internal procedures and functions from a non‑Progress client application such as one written in Java. You can use the OpenEdge™ ProxyGen tool to generate a proxy that supports this interface. Because the code generated by ProxyGen is based on the INTERNAL-ENTRIES of the Progress procedure, you can control the list of exactly which internal procedures and functions are exposed to ProxyGen by editing the contents of the prototype include files. For more information on prototype include files, see Chapter 6, “Advanced ADM Topics.” Because there is no specific client‑side support for SmartDataObjects in Java or Visual Basic, you must write code that uses the SmartDataObject API to control and communicate with the SmartDataObject as required by the application.
The following descriptions provide an overview of which procedures and functions you use to perform various operations. Generally, you can retrieve data from a SmartDataObject and return updates either in batch mode or a row at a time.
Batch-mode operations
In batch mode, you batch data in a Progress temp-table from a SmartDataObject and, when needed, back to the SmartDataObject. When a SmartDataObject is initialized and its database query opened, the object transfers rows from the query into the RowObject temp-table defined in the SmartDataObject. (By default, 200 rows are transferred at a time, but you can reset this with the setRowsToBatch function.) A non‑Progress client application should run serverSendRows to receive this table; this function returns the RowObject temp-table, which can be browsed from the client as an SQL dataset. If you make updates, you must construct a RowObjUpd dataset with the RowNum, RowIdent, RowMod, and ChangedFields fields set for each modified row. To return this dataset to the SmartDataObject, run serverCommit, which accepts the temp-table and returns the same table with any additional fields that might have been set by database triggers (key values and so forth), along with OUTPUT parameters that contain any error messages and the RowIdent fields of any records that were not updated because of errors. The calling sequence for the fetchMessages function is described in the format of the error message string.
Single-row operations
If you want to receive and return data a row at a time, use the colValues function to obtain desired column values for the current row in the data set, then use the fetchFirst, fetchNext, fetchPrev, fetchLast, and fetchRowIdent procedures to reposition the SmartDataObject’s query. Additional batches of rows are moved from the database query into the RowObject temp-table query automatically as necessary. To perform updates to individual rows, use the submitRow function to return updated values for a single row to the SmartDataObject. You can use the deleteRow procedure to delete the current row. You also use the addRow and copyRow procedures to create new rows starting with the initial values for the table or with the values from the previous current row. After these initial values have been returned to the caller, use the submitRow function to send the final field values back to the SmartDataObject to be written to the database.
Special considerations apply when you access a SmartDataObject from a Java application. For details, see the “Java applications and SmartDataObjects” section.