Using the IPB_Session interface

PowerBuilder Native Interface

Using the IPB_Session interface

  • Class accessor methods are used to find PowerBuilder classes, call PowerBuilder methods and events, and get and set instance variables of PowerBuilder objects.

  • Exception-handling methods communicate with the PowerBuilder exception handling mechanism.

  • Array accessor methods create and access PowerBuilder bounded and unbounded arrays.

  • Result set accessor methods work with result sets in DataStores and DataWindow controls.

  • Typed data access methods create and access data of the PowerBuilder types string, double, decimal, blob, date, time, datetime, and so forth.

  • Proxy access methods provide an interface for the implementation of new protocols.

  • The Release method releases the IPB_Session object itself.

// boolean isNull[], pbobject myobj, 
// and pbdate* d_date arguments passed in
pbclass cls;
pbmethodID mid;
PBCallInfo* ci = new PBCallInfo;
pbdate ret_date;
pbint yy,mm,dd;

cls = Session-> GetClass(myobj);
mid = Session-> GetMethodID(cls,"uf_getdate_byref",
      PBRT_FUNCTION,"YR");
Session-> InitCallInfo(cls, mid, ci);

if (isNull[0])
   ci -> pArgs -> GetAt(0)->SetToNull();
else    
   ci-> pArgs -> GetAt(0) ->SetDate(*d_date);

Session->InvokeObjectFunction(myobj, mid, ci);

Session->SplitDate(ci->pArgs->GetAt(0)->GetDate(),
   &yy,&mm,&dd);
Session->SetDate(*d_date, yy, mm, dd);

if (ci-> returnValue ->IsNull())
{
   ret_date = Session-> NewDate();
   Session-> SetDate(ret_val, 1900, 1, 1);
}
else
{
   ret_date = Session-> NewDate();
   Session -> SplitDate(ci-> returnValue -> GetDate(),
      &yy,&mm,&dd);
   Session -> SetDate(ret_val,yy,mm,dd);
}
Session -> FreeCallInfo(ci);
delete ci;
return ret_date;