JoltSetCarray Function

Action

Assigns specified data to a binary data item (“byte[]” in Java) of a Jolt object attribute. This function is provided to set data of both JoltSessionAttributes and JoltRemoteService object attributes. Besides, this function can be used to add new items to existing attributes as well as to create new attributes.

Include file

Jolt.bdh

Syntax

JoltSetCarray( in hJolt       :number,
               in sAttribute  : string,
               in sBinary     : string allownull,
               in nBinarySize : number optional,
               in nOccurrence : number optional ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hJolt Handle to a JoltSessionAttributes or JoltRemoteService object that was created with JoltSessionAttributesNew or JoltRemoteServiceNew, respectively
sAttribute Name of the attribute that is to be accessed
sBinary Binary data that is assigned to the specified attribute
nBinarySize Amount of binary data (in bytes) that is assigned to the specified attribute (optional).
nOccurrence

Index of the item that is to be set (optional). The index of an attribute’s first item is 1 (not 0).

If this parameter is omitted, the attribute’s first item is set.

If this parameter is set to ADD_VALUE, a new item is appended to the attribute (provided that the specified attribute already exists; otherwise, if the specified attribute does not yet exist, a new attribute with the given properties is created)

注: This parameter is ignored if hJolt represents a JoltSessionAttributes object.

Example

var
  hSession, hSessionAttr, hRemoteService: number;
 dcltrans
  transaction TInit
  begin
    JavaSetOption(JAVA_VERSION, JAVA_V11);
    JavaSetOption(JAVA_HOME, "c:/jdk1.1.7");
    JavaSetOption(JAVA_CLASSPATH, "c:/jdk1.1.7");
    JoltInit();
    hSessionAttr := JoltSessionAttributesNew();
    JoltSetString(hSessionAttr, APPADDRESS, "//lab:8000");
    hSession := JoltSessionNew(hSessionAttr, "", "ATM", "", "");
    hRemoteService := JoltRemoteServiceNew("XOR", hSession);
  end TInit; 

transaction TMain
  var
    sBinary    : string;
    nBinaryLen : number;
  begin
     JoltSetCarray(hRemoteService, "PLAIN", "\h45E295AFD03B631200");
     JoltSetCarray(hRemoteService, "PASSWORD", "secret\x00");
    JoltCall(hRemoteService);
    JoltGetCarray(hRemoteService, "CODE", NULL, 0, sBinary);
  end TMain; 

transaction TShutdown
  begin
    JoltEndSession(hSession);
    JoltFreeObject(hRemoteService);
    JoltFreeObject(hSession);
    JoltFreeObject(hSessionAttr);
  end TShutdown;

See also

Java: bea.jolt.JoltSessionAttributes class, bea.jolt.JoltRemoteService class