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

SetFieldValue Method

Applies To

ODynaset

Description

This method sets the value of a field.

Usage

oresult SetFieldValue(int index, const OValue &val)

oresult SetFieldValue(const char *fieldname, const OValue &val)

oresult SetFieldValue(int index, const char *val, int len)

oresult SetFieldValue(const char *fieldname, const char *val, int len)

oresult SetFieldValue(int index, int val)

oresult SetFieldValue(const char *fieldname, int val)

oresult SetFieldValue(int index, long val)

oresult SetFieldValue(const char *fieldname, long val)

oresult SetFieldValue(int index, double val)

oresult SetFieldValue(const char *fieldname, double val)

oresult SetFieldValue(int index, const char *val)

oresult SetFieldValue(const char *fieldname, const char *val)

oresult SetFieldValue(int index, const void __huge *blobp, long bloblen)

oresult SetFieldValue(const char *fieldname, const void __huge *blobp, long bloblen)

oresult SetFieldValue(int index, const OBlob &val)

oresult SetFieldValue(int index, const OClob &val)

oresult SetFieldValue(int index, const OBfile &val)

oresult SetFieldValue(int index, const ORef &val)

oresult SetFieldValue(int index, const OObject &val)

oresult SetFieldValue(int index, const OCollection &val)

oresult SetFieldValue(const char *fieldname, const OBlob &val)

oresult SetFieldValue(const char *fieldname, const OClob &val)

oresult SetFieldValue(const char *fieldname, const OBfile &val)

oresult SetFieldValue(const char *fieldname, const ORef &val)

oresult SetFieldValue(const char *fieldname, const OObject &val)

oresult SetFieldValue(const char *fieldname, const OCollection &val)

Arguments
Description
index
The 0-based index of the field. The index is the position of the field in the SQL query that created the current record set.
fieldname
The name of the field, as expressed in the SQL query.
val
The new value for the field, in one of various types.
blobp
Pointer to the long data to be placed in the field.
bloblen
The number of bytes from blobp to be placed into the field.
Remarks

These methods set the values of fields of data in the query result set. They change the values in the current record. You should call the StartEdit method on the record before any SetFieldValue calls are made. The field is specified either by index (position in the SQL query) or by fieldname. The data values can be set using data of any of the following types: OValue, int, long, double, and const char *. Setting a field's value to an empty string (namely "") sets the field to NULL.

The last two methods (the ones with the blobp arguments) are used to place more than 64K bytes of data into a long or long raw field. They are valid only for fields with server types of OTYPE_LONG or OTYPE_LONGRAW. Such fields can also have their values set with (const char *), but only up to 64K.

The SetFieldValue methods can fail under several conditions:

· if the current record is not valid

· if the indicated field does not exist

· if StartEdit has not been called on the current record (or AddNewRecord, or DuplicateRecord)

· if the type of the data being set cannot be coerced into the type needed by the database (for example trying to put "a boring string" into a number).

Return Value

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

Example

A snippet of code to give somebody a 7% raise:

// given an open ODynaset named empdyn that is on the right record

// get the current salary

double salary;

empdyn.GetFieldValue("sal", &salary);

// change it

empdyn.StartEdit();

empdyn.SetFieldValue("sal", salary*1.07);

empdyn.Update();


 
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