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.

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");

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

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

    double ret = getitemnumber.GetReturnValue()->GetDouble();
  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
  1. Micha Wehrli
  2. Wednesday, 22 May 2024 12:48 PM UTC
Can confirm, but I have no idea where the problem could be, if you make a simple wrapper function inside a PowerBuilder userobject around getitemdecimal, it works flawlessly.

So it seems like if you want to handle null values, your only option is to call to call your own PowerBuilder function.
  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.