IPB_Value interface:
Set<type> method
Description
Set of datatype-specific methods that set the value of the
IPB_Value instance.
Syntax
|
1 |
SetArray ( pbarray <span>array </span>) |
|
1 |
SetBlob( pbblob <span>blob </span>) |
|
1 |
SetBool ( pbboolean <span>boolean </span>) |
|
1 |
SetByte ( pbbyte <span>byte </span>) |
|
1 |
SetChar ( pbchar <span>char</span> ) |
|
1 |
SetDate ( pbdate <span>date </span>) |
|
1 |
SetDateTime( pbdatetime <span>datetime</span> ) |
|
1 |
SetDecimal ( pbdecimal <span>dec</span>) |
|
1 |
SetDouble ( pbdouble <span>double</span>) |
|
1 |
SetInt ( pbint <span>int</span> ) |
|
1 |
SetLong( pblong <span>long </span>) |
|
1 |
SetLongLong( pblonglong <span>longlong </span>) |
|
1 |
SetObject ( pbobject <span>object</span> ) |
|
1 |
SetPBString ( pbstring <span>string</span>) |
|
1 |
SetReal( pbreal <span>real </span>) |
|
1 |
SetString ( LPCTSTR <span>string</span>) |
|
1 |
SetTime( pbtime <span>time </span>) |
|
1 |
SetUint( pbuint <span>uint</span> ) |
|
1 |
SetUlong ( pbulong <span>ulong </span>) |
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:
|
1 |
pbclass cls;<br>pbmethodID mid;<br>PBCallInfo* ci = new PBCallInfo;<br>pbstring ret_val;<br>LPCTSTR pStr;<br> <br>cls= Session -> GetClass(myobj);<br>if (isAny) <br>   mid=Session-> GetMethodID(cls, "uf_any_byvalue",<br>      PBRT_FUNCTION, "AAAAA");<br>else<br>   mid=Session-> GetMethodID(cls, "uf_string_byvalue",<br>      PBRT_FUNCTION, "SSSSS");<br>Session-> InitCallInfo(cls, mid, ci);<br> <br>// Call IPB_Value SetPBString method<br>ci-> pArgs -> GetAt(0) -> <span>SetPBString</span>(s_low);<br>ci-> pArgs -> GetAt(1) -> <span>SetPBString</span>(s_mid);<br>ci-> pArgs -> GetAt(2) -> <span>SetPBString</span>(s_high);<br>pStr = Session -> GetString(s_null);<br> <br>if (pStr != 0)<br>{<br>   if (strcmp(pStr, "null") == 0 )<br>      ci-> pArgs -> GetAt(3) -> SetToNull();<br>   else<br>      ci-> pArgs -> GetAt(3) -> <span>SetPBString</span>(s_null);<br>}<br> <br>Session -> InvokeObjectFunction(myobj, mid, ci);<br>ret_val = Session -> NewString(""); |
|
1 |
<br>// Call IPB_Session SetString method<br>Session -> <span>SetString</span>(ret_val, Session->GetString<br>               (ci->returnValue->GetString()));<br>Session -> FreeCallInfo(ci);<br>delete ci;<br>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
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest