Skip Headers

Oracle® Objects for OLE C++ Class Library Developer's Guide
Release 9.2.0.4

Part Number B10954-01
Go To Table Of Contents
Contents

operator const char *

Applies To

OField,

OParameter

OValue

Description

This method returns the object's value as a string.

Usage

operator const char *() const

Remarks

This methods hands the value of the object back to the caller as a null-terminated string. If the object's current value is not a string, the method attempts to convert the value to a string. This can fail, resulting in the return of a NULL pointer.

The actual memory to which the returned pointer points is managed by the object. It should not be freed by the caller; it will be freed when the object is destroyed or closed or when another const char * cast is made.

Return Value

A valid, null-terminated const char pointer on success; NULL on failure.

Example

This example deletes all managers. We determine which employees are managers by casting the job field to a string.

// open the database

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

// open a dynaset on the employee table

ODynaset empdyn(odb, "select * from emp");

// get an OField object for looking at the job field

OField job = empdyn.GetField("job");

// look through all the employees

while (!empdyn.IsEOF())

{

if (0 == strcmp((const char *) job, "MANAGER"))

{ // we found a manager; delete that employee

empdyn.DeleteRecord();

}

// go to next record (gets us to valid record)

// or past EOF if there are no more records

empdyn.MoveNext();

}


 
Oracle
Copyright © 1998, 2003 Oracle Corporation.

All Rights Reserved.
Go To Table Of Contents
Contents