1. Roland Smith
  2. PowerBuilder
  3. Monday, 6 May 2024 17:03 PM UTC

Has anyone accessed datastore objects from C++ using PBNI?

The help has small snippets for each function but nothing that explains the entire process.

Who is viewing this page
Micha Wehrli Accepted Answer Pending Moderation
  1. Wednesday, 15 May 2024 13:24 PM UTC
  2. PowerBuilder
  3. # 1

To me it seems like the PBNI is incomplete when it comes to IPB_RSItemData, since there seems to be no way to create the interface.

But you are able to directly call the PowerBuilder methods of a datastore using something like:

    pbobject datastore;

    PBObjectFunctionInvoker insertrow(m_Session, datastore, L"insertrow");
    insertrow.GetArg(0)->SetLong(1);
    insertrow.Invoke();

    PBObjectFunctionInvoker setitem(m_Session, datastore, L"setitem");
    setitem.GetArg(0)->SetLong(1); // row
    setitem.GetArg(1)->SetInt(1); // col
    setitem.GetArg(2)->SetDouble(13.37);
    setitem.Invoke();

    PBObjectFunctionInvoker getitemnumber(m_Session, datastore, L"getitemnumber");
    getitemnumber.GetArg(0)->SetLong(1); // row
    getitemnumber.GetArg(1)->SetInt(1); // col
    getitemnumber.Invoke();

    double ret = getitemnumber.GetReturnValue()->GetDouble();
Comment
  1. Roland Smith
  2. Thursday, 16 May 2024 03:42 AM UTC
Micha, this works well except for getitemdecimal. If the value is null, the invoke aborts.
  1. Helpful
  1. Roland Smith
  2. Thursday, 16 May 2024 03:45 AM UTC
The decimal column is defined as decimal(0). Should I call getitemnumber when width = 0?
  1. Helpful
  1. Roland Smith
  2. Thursday, 16 May 2024 12:59 PM UTC
The standard InvokeObjectFunction method also aborts on nulls. It does not abort on strings, only decimal.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.