воскресенье, 15 мая 2005 г.

4D How to execute a stored procedure with 4D Open for Java

4D Knowledgebase Resource Detail: "How to execute a stored procedure with 4D Open for Java

Product: 4D Open for JAVA

Version: 6.7

Platform: Mac & Win
Detail

The following code will show you what to code in order to create a stored procedure with 4D Open for Java.

In this first example, given a 4D method named My4DMethod with a stack size of 32000 - this method can be launched in any instances. This method will also accept an alphaniumeric parameter ($1) named MyParameter.

opServerProcess executeOnProcess = new opServerProcess();
opVariableArray myVarArray = new opVariableArray(1);
executeOnProcess.mMethodName = new String('My4DMethod ');
executeOnProcess.mProcessName = new String('SP_Java');
executeOnProcess.mStackSize = 32000;
executeOnProcess.mUnique = 0;
myVarArray.mVariableArray[0].mData = new opData(ALPHANUMERIC,'MyParameter');
p.ExecuteOnServer(executeOnProcess, myVarArray);

Now, let's add one more parameter, a LONGINT parameter. Its value will be 5.

opServerProcess executeOnProcess = new opServerProcess();
opVariableArray myVarArray = new opVariableArray(2);
executeOnProcess.mMethodName = new String('My4DMethod ');
executeOnProcess.mProcessName = new String('SP_Java');
executeOnProcess.mStackSize = 32000;
executeOnProcess.mUnique = 0;
myVarArray.mVariableArray[0].mData = new opData(ALPHANUMERIC,'MyParameter');
myVarArray.mVariableArray[1].mData = new opData(LONGINTEGER,5);
p.ExecuteOnServer(executeOnProcess, myVarArray);"

Комментариев нет: