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

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();

}