Skip Headers
Oracle® Objects for OLE C++ Class Library Developer's Guide
10g Release 2 (10.2)

Part Number B14308-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Refresh (OSqlStmt) Method

Applies To

OSqlStmt

Description

This method executes the current SQL statement, which is set by the Open method and reset by the SetSQL method.

Usage

oresult Refresh(void)

Remarks

Using osqlstmt.Refresh is the preferred refresh method when changing parameter values, because the required database operations are minimized (SQL parsing, binding, and so on). This refresh method can lead to much improved performance when only parameter values have changed.

Return Value

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

Example

// open an ODatabase

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

// get the parameter collection

OParameterCollection pcoll = odb.GetParameters();

OParameter p1 = pcoll.Add("EMPNO", 7369, OPARAMETER_INVAR, OTYPE_NUMBER);

OParameter p2 = pcoll.Add("ENAME", "me", OPARAMETER_OUTVAR, OTYPE_VARCHAR2);

// now set up a dynaset that uses that parameter

OSqlStmt osqlstmt(odb, "Begin Employee.GetEmpName (:EMPNO, :ENAME); end;");

// Should display SMITH

OValue temp;

MessageBox(p2.GetValue(&temp));

// set EMPNO parameter value to 7499

p1.SetValue(7499);

// and refresh the dynaset to get the new records

osqlstmt.Refresh();

// Should display ALLEN

OValue temp;

MessageBox(p2.GetValue(&temp));