Oracle® Objects for OLE C++ Class Library Developer's Guide 10g Release 2 (10.2) Part Number B14308-01 |
|
Applies To
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
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. |
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:
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();