version 1.5
OP Set option (optionNumber; optionValue) Longint
Parameter | Type | Description | |
optionNumber | Longint | Number of the option to set | |
optionValue | Longint | Value to which to set the option | |
Function result | Longint | Error code result for the function |
Description
OP Set option lets you set some operating options for 4D Open for 4th Dimension.
The codes for optionNumber and optionValue are listed in the following table:
Option | Value | Description |
1 | 1 / 0 | Turn parameter checking mode On/Off. On is the default. |
2 | 1 / 0 | Turn Error dialog box On/ Off. On is the default. |
3 | 1 / 0 | Caching structure information is or is not authorized. |
4 | n | Element bound when arrays are used with record routines. |
Default is element zero. | ||
(NCID*65536)+ Code | 1 / 0 | Set a network component option. See the following code table. |
Option 1 - Parameter checking mode
When parameter checking is on, 4D Open for 4th Dimension checks the validity of the parameters. For example, if a parameter is the table number of the served database, the program senda a request to check whether or not the table exists. This option is on by default. You can turn it off by calling OP Set option(1;0). Checking the parameters slows down operations.
Option 2 - Error dialog box option
This option, which is on by default, displays the Error dialog box when an error occurs.
Option 3 - Caching structure information
This option, which is off by default, tells 4D Open for 4th Dimension whether or not caching structure calls can be made. You can turn it on by calling OP Set option(3;1). Once the option has been turned on, you can use the OP Cache structure routine. Caching the structure speeds up some operations.
Option 4 - Binding with arrays
When you use arrays in binds, the element 0 is used for record routines by default. You may change this element using OP Set option (4;ElementNumber).
Network component options
OP Set option allows you to set some options for your network component. This features allows expert users to change some of the connection parameters. 4D Open for 4th Dimension does not check the options you have set; some changes may lead to problems. When used this way,
optionValue = (NCID * 65536) + Code of option to set
You can obtain NCID (the network component ID) using OP Get network component info.
Use OP Set option to set a network component option only when the network component is not currently initialized.
The codes for the options to set require detailed knowledge of the network components and should be used only by expert programmers. The codes are:
Code | Name | Description |
1 | Version | This field indicates the version of the network component. |
You must NOT modify the value of this field. | ||
2 | LockDelay | This field is used by the ADSP component when used with 4D Client. |
You must NOT modify the value of this field. | ||
3 | IdleDelay | This field must be equal to zero. |
4 | BufferSize | This field indicates the size (in bytes) of the communication buffers |
used by the network component. | ||
5 | PackOption | This field tells the network component to perform automatic data |
compression when sending a data buffer over the network. | ||
6 | MinPackSize | If PackOption is equal to 1 (data is compressed), this field specifies the |
minimum size (in bytes) of the buffers to be compressed. | ||
7 | MaxPackSize | If PackOption is equal to 1 (data is compressed), this field specifies the |
maximum size (in bytes) of the buffers to be compressed. | ||
8 | DelayVoyant | This field must be equal to 0. |
9 | Product ID | This field specifies the type of application in which the network |
component is running. | ||
10 | Flags | This field is a set of 32 bits. Each bit is set to either 1 or 0 depending on |
the value of the corresponding option for the network component. |
Error Codes
If OP Set option executed successfully, it returns 0. Otherwise, it returns the following errors:
Error Code | Description |
-192 | Resource not found. |
10128 | The 4D Open for 4th Dimension package has not been initialized. |
10132 | The network component is currently in use. |
10148 | Unknown option requested to 4D Open for 4th Dimension. |
10154 | This command cannot be executed right now. |
10165 | Unknown network component option. |
Example
In this example, 4D Open for 4D checks the validity of parameters while in a debugging phase. At a more advanced stage of debugging, it also turns structure caching ON.
If (<>vDebugLevel >= checkParams ) ` Debug phase is in progress, set parameter checking on for improved security ` Set parameters checking option(option 1) ON (value 1) for 4D Open $errCode := OP Set option (1;1 ) Else ` Debug phase is very advanced, remove parameter checking for improved performance ` Set parameters checking option(option 1) OFF (value 0) for 4D Open $errCode := OP Set option (1;0 ) If (<>vDebugLevel = final ) ` No more debugging, server structure is final, start caching structure information $errCode : = OP Set option (3;1) $errCode := OP Cache structure (vConnectID;1) Else $errCode : = OP Set option (3;0) End if End if
See Also