Oracle Objects for OLE C++ Class Library
Release 9.2

Part Number A95896-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback

Refresh (ODynaset) Method

Applies To

ODynaset

Description

This method executes the dynaset's SQL statement and fetches a new set of records.

Usage

oresult Refresh(void)

Remarks

This method executes the current SQL statement, which is set by the Open method and reset by the SetSQL method. Execution of this method discards the current result set and the current local cache and returns to the database to get new values. After refreshing, the current record becomes the first record in the result set (which may not be the same as the first record of the previous result set). Execution of this method sends an OADVISE_REFRESH message to all attached advisories.

If the dynaset is being managed by an OBinder, this method calls the PreQuery and PostQuery triggers.

Return Value

An oresult indicating whether the operation succeeded (OSUCCESS) or not (OFAILURE).

Example

A powerful use of Refresh is with parameters. When the value of the parameter changes, we can Refresh the dynaset and get a different set of records.

// open an ODatabase

ODatabase odb("ExampleDB", "scott", "tiger");

// get the parameter collection

OParameterCollection params = odb.GetParameters();

// add a parameter for department number

params.Add("dno", 10, OPARAMETER_INVAR, OTYPE_NUMBER);

// now set up a dynaset that uses that parameter

ODynaset odyn(odb, "select * from emp where deptno = :dno");

// do some processing with that dynaset

// now we want to look at records from another department

// get the parameter and set its value to 20

params.GetParameter("dno").SetValue(20);

// and refresh the dynaset to get the new records

odyn.Refresh();

/*

We can get different sets of records without manipulating SQL statements.

*/


 
Oracle
Copyright © 1998, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback