Using Database Operations

Result Sets

The SQL Server Adapter supports the following 3 types of Result Sets:

By default, the SQL Server Adapter uses Forward only. To traverse backward, you must explicitly set the result set type as scroll sensitive or scroll insensitive according to the requirement.

Type_Forward_Only

The result set is nonscrollable; its cursor moves forward only, from top to bottom. The view of the data in the result set depends on whether the DBMS materializes results incrementally.

Type_Scroll_Insensitive

The result set is scrollable: Its cursor can move forward or backward and can be moved to a particular row or to a row whose position is relative to its current position. The result set generally does not show changes to the underlying database that are made while it is open. The membership, order, and column values of rows are typically fixed when the result set is created.

Type_Scroll_Sensitive

The result set is scrollable; its cursor can move forward or backward and can be moved to a particular row or to a row whose position is relative to its current position. The result set is sensitive to changes made while it is open. If the underlying column values are modified, the new values are visible, thus providing a dynamic view of the underlying data. The membership and ordering of rows in the result set may be fixed or not, depending on the implementation.

Using Result Sets with stored procedures:

In order to scroll back in a result set returned from a stored procedure, the <OTD>.setScrollTypeToScrollInsensitive() method should be called before any other methods for the OTD.

Example:

Sch_StoredProcedures.setScrollTypeToScrollInsensitive();

Sch_StoredProcedures.getUsp_GetAppointment().setPatientID( PatientID );

Sch_StoredProcedures.getUsp_GetAppointment().setAppointmentDate( ApointmentDateTime );

Sch_StoredProcedures.getUsp_GetAppointment().execute();

Sch_StoredProcedures.getUsp_GetAppointment().enableResultSetsOnly();

If the <OTD>.setScrollTypeToScrollInsensitive() method is not called, then any attempt to move back in the resultset will fail.

Example:

Executing ’Sch_StoredProcedures.getUsp_GetAppointment().get$usp_GetAppointmentResultSets0().first();’ will fail with the exception: ’Unsupported method: ResultSet.first’.