Set<type>

PowerBuilder Native Interface

IPB_Value interface:

Set<type> method

Description

Set of datatype-specific methods that set the value of the IPB_Value instance.

Syntax

SetArray ( pbarray array ) 
SetBlob( pbblob blob ) 
SetBool ( pbboolean boolean ) 
SetByte ( pbbyte byte ) 
SetChar ( pbchar char ) 
SetDate ( pbdate date ) 
SetDateTime( pbdatetime datetime ) 
SetDecimal ( pbdecimal dec) 
SetDouble ( pbdouble double) 
SetInt ( pbint int ) 
SetLong( pblong long ) 
SetLongLong( pblonglong longlong ) 
SetObject ( pbobject object ) 
SetPBString ( pbstring string) 
SetReal( pbreal real ) 
SetString ( LPCTSTR string) 
SetTime( pbtime time ) 
SetUint( pbuint uint ) 
SetUlong ( pbulong ulong ) 

Return Values

PBXRESULT.

Examples

This example uses the IPB_Value SetPBString method to set values in PBCallInfo. It also uses the IPB_Session SetString method to set the ret_val string to the return value in the PBCallInfo structure:

pbclass cls;
pbmethodID mid;
PBCallInfo* ci = new PBCallInfo;
pbstring ret_val;
LPCTSTR pStr;

cls= Session -> GetClass(myobj);
if (isAny)
   mid=Session-> GetMethodID(cls, "uf_any_byvalue",
      PBRT_FUNCTION, "AAAAA");
else
   mid=Session-> GetMethodID(cls, "uf_string_byvalue",
      PBRT_FUNCTION, "SSSSS");
Session-> InitCallInfo(cls, mid, ci);

// Call IPB_Value SetPBString method
ci-> pArgs -> GetAt(0) -> SetPBString(s_low);
ci-> pArgs -> GetAt(1) -> SetPBString(s_mid);
ci-> pArgs -> GetAt(2) -> SetPBString(s_high);
pStr = Session -> GetString(s_null);

if (pStr != 0)
{
   if (strcmp(pStr, "null") == 0 )
      ci-> pArgs -> GetAt(3) -> SetToNull();
   else
      ci-> pArgs -> GetAt(3) -> SetPBString(s_null);
}

Session -> InvokeObjectFunction(myobj, mid, ci);
ret_val = Session -> NewString("");

// Call IPB_Session SetString method
Session -> SetString(ret_val, Session->GetString
               (ci->returnValue->GetString()));
Session -> FreeCallInfo(ci);
delete ci;
return ret_val;

Usage

These methods automatically set the value of IPB_Value to not null and return an error if the datatype to be set does not match the existing datatype. The error code is PBX_E_MISMATCHED_DATA_TYPE. If the value is a read-only argument, it returns the error PBX_E_READONLY_ARGS. If the datatype is string or blob, a deep copy is performed. The existing value is destroyed first, and then the contents of the argument are copied into a new value.

See Also

Get<type>