4D S.A. Copyright 2001

j4d.open
Class opProcess

java.lang.Object
  |
  +--j4d.open.opStd
        |
        +--j4d.open.opProcess
All Implemented Interfaces:
opConstants

public class opProcess
extends opStd

This object is the main object of the API and handles all the queries which can be sent to a 4D Server through 4D Open for Java.


Field Summary
 java.lang.String mMethodName
           
 java.lang.String mProcessName
           
 int mStackSize
           
 java.lang.String mStationName
           
 int mTimeSpent
           
 byte mUnique
           
 java.lang.String mUserName
           
 
Fields inherited from class j4d.open.opStd
CharSet_4D_Server, TabConv, VM_CharSetSupported
 
Fields inherited from interface j4d.open.opConstants
ACCESS_PRIVILEGE_VIOLATION, ALLOW_4D_CLIENT_ONLY_IS_CHECKED, ALPHANUMERIC, ALPHANUMERIC_ARRAY, ALPHANUMERIC2, AND, API_NOT_COMPATIBLE_WITH_SERVER, BACKUP_IN_PROGRESS, BAD_SEARCH_TABLE_DEFINITION, BAD_SORT_TABLE_DEFINITION, BLOB, BLOB_ARRAY, BLOBSTA, BOOLEAN, BOOLEAN_ARRAY, CHARSET_PROBLEM, CONNECTION_DO_ERR, CONNECTION_LL1_ERR, CONNECTION_LL2_ERR, CONNECTION_LL3_ERR, CONNECTION_LL4_ERR, CONTAIN, DATA_FIELD_PROBLEM, DATE, DATE_ARRAY, DISCONNECTION_ERR, DOES_NOT_CONTAIN, DUPLICATE_KEY_INDEX, EQUAL, EXCEPT, FIELD_IS_NOT_INDEXED, FIELD_IS_NOT_RELATED_TO, FIELD_NUMBER_IS_OUT_OF_RANGE, GREATER_THAN, GREATER_THAN_OR_EQUAL, INDEX_PAGE_OUT_OF_RANGE, INTEGER, INTEGER_ARRAY, INVALID_FIELD_TABLE_DEFINITION, INVALID_FIELD_TYPE, INVALID_INDEX_PAGE, INVALID_PASSWORD, INVALID_RECORD_ADDRESS, INVALID_RECORD_NUMBER, INVALID_RECORD_STRUCTURE, INVALID_SELECTED_RECORD_NUMBER, INVALID_STRUCTURE, INVALID_TYPE_REQUESTED, LESS_THAN, LESS_THAN_OR_EQUAL, LIMIT_OF_DEMO, LONGINTEGER, LONGINTEGER_ARRAY, MAXIMUM_NUMBER_OF_RECORDS_REACHED, NO_ARRAY_BLOB, NO_CURRENT_RECORD, NO_MORE_SPACE_AVAILABLE_TO_SAVE_RECORD, NONE, NOT_EQUAL, OLD_SERVER_ERR, OR, OTHER_RECORD_ARE_RELATED, PICTURE, PICTURE_ARRAY, PREPARE_LOGIN_ERR, PROCESS_COULD_NOT_BE_STARTED, REAL, REAL_ARRAY, RECORD_ALLREADY_DELETED, RECORD_COULD_NOT_BE_LOADED, RECORD_LOCKED_DURING_AUTOMATIC_DELETION, RECORD_NOT_IN_SELECTION, RECORD_OUT_OF_RANGE, RECURSIVE_INTEGRITY, SELECTION_DOES_NOT_EXIST, SLEEPING_PROCESS_ERR, STACK_IS_FULL, START_PROCESS_ERR, STOP_PROCESS_ERR, STRUCTURE_IS_LOCKED, SUBTABLE, TABLE_NUMBER_IS_OUT_OF_RANGE, TEXT, TEXT_ARRAY, TEXTSTA, TIME, TIME_ARRAY, TIME_OUT_EXPIRED, TIMEOUT, TRANSACTION_CANCELLED_DUPLICATE_KEY, TRANSACTION_INDEX_PAGE_COULD_NOT_BE_LOADED, TRIC_RESSOURCES_ARE_NOT_THE_SAME, UNABLE_TO_CLEAR_SELECTION, UNABLE_TO_OPEN_SOCKET_ERR, UNKNOWN_USER, UNSPECIFIED_CURRENT_RECORD, UNSPECIFIED_FIELD, UNSPECIFIED_FIELD_NAME, UNSPECIFIED_LOP, UNSPECIFIED_PROCESS_NAME, UNSPECIFIED_RECORD, UNSPECIFIED_RECORD_IN_SELECTION, UNSPECIFIED_SELECTION_NAME, UNSPECIFIED_SEMAPHORE_NAME, UNSPECIFIED_SET_NAME, UNSPECIFIED_SOP, UNSPECIFIED_TABLE, UNSPECIFIED_TABLE_NAME, UNSPECIFIED_TARGET_TABLE, VINTERPROCESS, VPROCESS
 
Constructor Summary
opProcess()
           
 
Method Summary
 void AddToSet(opSet set, opTable table)
          The method AddToSet adds the current record of table to the set.
 opSelection AllRecords(opTable table)
          The method AllRecords selects all the records in opTable and makes the first record in the file the current record.
 void ArrayToSelection(opDataArray[] tabDataArray, opFieldArray tabField)
          The method ArrayToSelection updates the records in the current selection of a table and/or creates new records in this table.
 double AverageField(opField field)
          The method AverageField returns the arithmetic mean (average) of the target field in the current selection.
 void CancelTransaction()
          The method CancelTransaction cancels the transaction that was started by StartTransaction and leaves the database unchanged by cancelling the operations executed during the transaction.
 void ClearNamedSelection(opSelection selection)
          The method ClearNamedSelection clears the table selection from the memory and frees the used space.
 void ClearSemaphore(java.lang.String semaphore_name)
          The method ClearSemaphore deletes a semaphore previously set by the SetSemaphore method.
 void ClearSet(opSet set)
          The method ClearSet clears set from memory and frees the used memory.
 void CopyNamedSelection(opSelection selection)
          The method CopyNamedSelection copies the table current selection into the selection.
 void CopySet(opSet src_set, opSet new_set)
          The method CopySet makes a copy of the set src_set into the set new_setname.
 short CountTables()
          The command CountTables count the number of tables in the database.
 short CountUserProcesses()
          The method CountUserProcesses returns the number of user processes currently running.
 short CountUsers()
          The method CountUsers returns the number of users currently connected to the server.
 void CreateEmptySet(opSet set)
          The method CreateEmptySet fills the object set (of opSet type) previously created with the current selection.
 void CreateRecord(opFieldArray fa, opDataArray dataArray)
          The method CreateRecord creates a new record for the table specified by table with the contents of dataArray.
 void CreateRecord(opTable table, opDataArray dataArray)
          Deprecated. Since JOpen 6.7.1, replaced by CreateRecord(opFieldArray, opDataArray).
The method CreateRecord creates a new record for the table specified by table with the contents of dataArray. If you do not specify the values for certain fields, 4D Server initializes the fields to their default values.
The new record becomes the current record and the current selection (a one-record selection).
 void CreateSet(opSet set)
          The method CreateSet fills the object set (of opSet type) previously created with the current selection.
 void CutNamedSelection(opSelection selection)
          The method CutNamedSelection moves the targetFile current selection to the selection passed as parameter.
 void DeleteRecord(opTable table)
          The method DeleteRecord deletes the target table current record in the process.
 void DeleteSelection(opSelection selection)
          The method DeleteSelection deletes records from the selection.
 void DifferenceSet(opSet src_set, opSet dif_set, opSet dst_set)
          The method DifferenceSet compares src_set and dst_set and excludes all records that are in dst_set from the dif_set.
 opDataArray DistinctValues(opField field)
          The method DistinctValues returns an opDataArray containing the distinct values found in an indexed field for the records in the current selection.
 void ExecuteOnServer(opServerProcess remote_process, opVariableArray variableArray)
          The method ExecuteOnServer starts a new process on the Server and returns the process number for that process.
 void FlushBuffers()
          The method FlushBuffers immediately saves the data buffers to the disk.
 java.util.GregorianCalendar GetDate()
          The method GetDate returns the date of the 4D Server machine using GregorianCalendar class.
 void GetFieldNumbers(opFieldArray fieldArray)
          The method GetFieldNumbers allows you to retrieve the table and field numbers that correspond to a set of table and field names.
 opServerProcessArray GetProcessList()
          The method GetProcessList returns in an array of opProcess objects which contain information about all the processes on the server.
 void GetProcessNumber(opServerProcess remote_process)
          The method GetProcessNumber loads in the field remote_process.mProcessID the current process number.
 void GetProcessVariable(opServerProcess remote_process, opVariableArray variableArray)
          The method GetProcessVariable reads the srcVar process variables (srvVar2, etc.) from the source process whose number is passed in remote_process, and returns their current values in the dstVar variables (dstVar2, etc.) of the current process.
 void GetTableNames(opTableArray tableArray)
          The method GetTableNames returns the table names in the database.
 void GetTableProperties(opTable table)
          The method GetTableProperties returns detailed information about the target table and its associated fields.
 java.util.GregorianCalendar GetTime()
          The method GetTime returns the time of the 4D Server machine using GregorianCalendar class.
 void GotoRecord(opTable table)
          The method GotoRecord selects the record record number is passed in table.mRecordNumber as the current record of the target table for the connection.
 void GotoSelectedRecord(opSelection selection)
          The method GotoSelectedRecord makes the specified record in the specified selection the current record.
 void IntersectionSet(opSet src_set, opSet in_set, opSet dst_set)
          The method IntersectionSet compares src_set and dst_set and selects only the records that are in both.
 boolean IsInSet(opSet set)
          The method IsInSet tests whether or not the current record for the table is in set.
 opDataArray LoadFields(opFieldArray fieldArray)
          The method LoadFields returns an array of data containing the values of the specified fields in the current record.
 double MaxField(opField field)
          The method MaxField returns the maximum value for the target field in the current selection.
 double MinField(opField field)
          The method MinField returns the minimum value for the target field in the current selection.
 void ModifyRecord(opFieldArray fa, opDataArray dataArray)
          The method ModifyRecord modifies the specified fields the current record.
 void ModifyRecord(opTable table, opDataArray dataArray)
          Deprecated. Since JOpen 6.7.1, replaced by ModifyRecord(opFieldArray, opDataArray).
The method ModifyRecord modifies the current record for the table specified by table. If dataArray does not contain all the fields in the table, only the specified fields will be modified.
To use ModifyRecord, the current record must have read/write access and should not be locked.
If there is no current record, then ModifyRecord does nothing. This method does not affect the current selection.
 void OrderBy(opFieldArray fieldArray)
          The method OrderBy sorts the current selection of target table, based on the sort definition.
 void ReadOnly(opTable table)
          The method ReadOnly changes the access mode of the table to read-only for the process in which it is called.
 void ReadWrite(opTable table)
          The method ReadWrite changes the access mode of the file to read-write for the process in which it is called.
 void RecordsInSelection(opSelection selection)
          The method RecordsInSelection returns the number of records in the selection for the connection.
 void RecordsInTable(opTable table)
          The method RecordsInTable fill the field mRecordsInTable with the total number of records in the target table.
 void ReduceSelection(opSelection selection)
          The method ReduceSelection reduces the selection to the first mRecordNumber in the selection.
 void RelateMany(opField field)
          The method RelateMany creates a selection of records in the Many table based on the selection in the One table.
 void RelateOne(opTable from_table, opTable to_table)
          The method RelateOne creates a new selection of records in to_table based on the selection of records in from_table.
 void RemoveFromSet(opSet set, opTable table)
          The method RemoveFromSet removes the table current record from set.
 opSelection Search(opSearchArray searchArray)
          The method Search performs a search using the search definition whose pointer is passed and returns in opSelection the number of records found in the table.
 opSelection SearchInSelection(opSearchArray searchArray)
          The method SearchInSelection performs a search using the search passed in searchArray and returns in opSelection the number of records found in the selection.
 void SelectionToArray(opDataArray[] tabDataArray, opFieldArray tabField)
          The method SelectionToArray returns a buffer containing the concatenated values of the fields you requested for the records in the current selection(s) of the specified table(s).
 void SequenceNumber(opTable table)
          The method SequenceNumber fill the field table.mSequenceNumber with the next sequence number for that table.
 void SetProcessVariable(opServerProcess remote_process, opVariableArray variableArray)
          The method SetProcessVariable writes the process variables of the destination process whose number is passed in remote_process using the values passed in mProcessID.
 boolean SetSemaphore(java.lang.String semaphore_name)
          A semaphore is a flag shared among workstations (each user's computer) or among processes on the same workstation.
 void StartTransaction()
          The method StartTransaction starts a transaction.
 double SumField(opField field)
          The method SumField returns the sum, which is the total of all values, for the target field in the current selection.
 void UnionSet(opSet src_set, opSet un_set, opSet dst_set)
          The method UnionSet creates a set that contains all records from src_set and dst_set.
 void UnloadRecord(opTable table)
          The method UnloadRecord unloads the current record of the table once you have finished using it.
 void UseNamedSelection(opSelection selection)
          The method UseNamedSelection makes the selection the current selection of the table.
 void UseSet(opSet set)
          The method UseSet makes the records in set the current selection for the set table.
 void ValidateTransaction()
          The method ValidateTransaction accepts the transaction that was started by StartTransaction and saves the changes to the database that occurred during the transaction.
 
Methods inherited from class j4d.open.opStd
AsciiToUnicode_Old, AsciiToUnicode, setCharSet, UnicodeToAscii_Old, UnicodeToAscii
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mUserName

public java.lang.String mUserName

mStationName

public java.lang.String mStationName

mMethodName

public java.lang.String mMethodName

mProcessName

public java.lang.String mProcessName

mTimeSpent

public int mTimeSpent

mStackSize

public int mStackSize

mUnique

public byte mUnique
Constructor Detail

opProcess

public opProcess()
Method Detail

AllRecords

public opSelection AllRecords(opTable table)
                       throws opException
The method AllRecords selects all the records in opTable and makes the first record in the file the current record. These records are in the order in which they appear on disk. AllRecords returns the records to the default record order, which is the order in which the records are stored on disk.
Parameters:
Table - to extract the selection
Returns:
table Result selection
See Also:
4D Open for Java examplet

DeleteSelection

public void DeleteSelection(opSelection selection)
                     throws opException
The method DeleteSelection deletes records from the selection. Once the records are deleted, the selection is empty. Records that are deleted during a transaction are locked for the other users and other processes until the transaction is validated or canceled. If the selection is empty, DeleteSelection has no effect. DeleteSelection does not delete locked records; they are skipped. Warning: Deleting a selection of records is a permanent operation which cannot be undone.
Parameters:
selection - Selection to delete
See Also:
4D Open for Java examplet

RecordsInSelection

public void RecordsInSelection(opSelection selection)
                        throws opException
The method RecordsInSelection returns the number of records in the selection for the connection.
Parameters:
selection - Selection to count the records

GotoSelectedRecord

public void GotoSelectedRecord(opSelection selection)
                        throws opException
The method GotoSelectedRecord makes the specified record in the specified selection the current record. The current selection does not change. Records are numbered from 1 to n, in the order in which they appear in the selection. If there are no records in the selection, or the number specified is not in the selection, then GotoSelectedRecord does nothing and throws an exception.
Parameters:
selection - Selection in which to move

ReduceSelection

public void ReduceSelection(opSelection selection)
                     throws opException
The method ReduceSelection reduces the selection to the first mRecordNumber in the selection. ReduceSelection changes the selection of table for the current process. The first record of the new selection becomes the current record.
Note: A quick way to make the current selection empty is to call ReduceSelection and pass 0 in mRecordNumber.
Parameters:
selection - Selection to reduce

CopyNamedSelection

public void CopyNamedSelection(opSelection selection)
                        throws opException
The method CopyNamedSelection copies the table current selection into the selection. The current selection for the current process is not changed. Use ClearNamedSelection to clear the selection and to free the used space.
Parameters:
selection - Destination selection
See Also:
4D Open for Java examplet

CutNamedSelection

public void CutNamedSelection(opSelection selection)
                       throws opException
The method CutNamedSelection moves the targetFile current selection to the selection passed as parameter.

CutNamedSelection differs from CopyNamedSelection since it does not copy the current selection, but rather moves the targetFile current selection. Once the routine has been executed, the targetFile current selection in the current process is left empty (it does not contain any record).

CutNamedSelection uses less memory than CopyNamedSelection. With CopyNamedSelection, 4D Server must allocate additional memory for the named selection. With CutNamedSelection, only the reference to the list is moved.

Parameters:
selection - Destination selection
See Also:
4D Open for Java examplet

UseNamedSelection

public void UseNamedSelection(opSelection selection)
                       throws opException
The method UseNamedSelection makes the selection the current selection of the table. When you create a named selection, the current record is “remembered” by the named selection. UseNamedSelection retrieves the position of the current record and makes it the new current record of the new current selection. Like the current selection, a named selection does not contain the records themselves, but rather a list of references to these records. Consequently, if a record is deleted or modified once the named selection has been created, the following may happen when using the named selection:

• Deleted records will appear as blank records in the new current selection,

• Records using the space left by deleted records in the same table may appear in the new current selection,

• Modified records will appear modified in the new current selection.

Parameters:
selection - Destination selection
See Also:
4D Open for Java examplet

ClearNamedSelection

public void ClearNamedSelection(opSelection selection)
                         throws opException
The method ClearNamedSelection clears the table selection from the memory and frees the used space.
Note: If a named selection was created using CutNamedSelection and reused by a call to UseNamedSelection, it no longer exists in memory. In this case, ClearNamedSelection does not need to be used.
Parameters:
selection - Selection to clear
See Also:
4D Open for Java examplet

ReadOnly

public void ReadOnly(opTable table)
              throws opException
The method ReadOnly changes the access mode of the table to read-only for the process in which it is called. If you pass -1 for table.mTableNumber, the access mode is changed for all the tables in the database.
Warning: this command is not retroactive. A record is loaded according to the table’s read/write status at the time of loading. To load a record from a read/write table in read-only mode, you must first change the table state to read-only.
Parameters:
table - Table to set in ReadOnly mode

ReadWrite

public void ReadWrite(opTable table)
               throws opException
The method ReadWrite changes the access mode of the file to read-write for the process in which it is called. If you pass -1 for table.mTableNumber, the access mode is changed for all the tables in the database. After a call to ReadWrite, when a record is loaded, the record is unlocked if no other user has locked the record. This command does not change the status of the currently loaded record, only that of the following loaded records.

The default state for all tables is read/write.

Warning: This command is not retroactive. A record is loaded according to the table’s read/write status at the time of loading. To load a record from a read-only table in read/write mode, you must first change the table state to read/write.
Parameters:
table - Table to set in ReadWrite mode

UnloadRecord

public void UnloadRecord(opTable table)
                  throws opException
The method UnloadRecord unloads the current record of the table once you have finished using it.
Note: 4D Client automatically unloads the current record when you work on another record. However, with 4D Open for Java you must use this routine to unload a current record that you have successfully accessed in read-write mode, regardless of the operation that you perform afterwards.
Parameters:
table - Table containing the current record to unload

StartTransaction

public void StartTransaction()
                      throws opException
The method StartTransaction starts a transaction. All changes to the database will be stored temporarily for this connection until the transaction is accepted or cancelled by calling ValidateTransaction or CancelTransaction.
Note: You can have only one transaction per process. To run more than one transaction at a time, you can open a separate connection for each transaction.
See Also:
4D Open for Java examplet

ValidateTransaction

public void ValidateTransaction()
                         throws opException
The method ValidateTransaction accepts the transaction that was started by StartTransaction and saves the changes to the database that occurred during the transaction.

CancelTransaction

public void CancelTransaction()
                       throws opException
The method CancelTransaction cancels the transaction that was started by StartTransaction and leaves the database unchanged by cancelling the operations executed during the transaction.
See Also:
4D Open for Java examplet

DeleteRecord

public void DeleteRecord(opTable table)
                  throws opException
The method DeleteRecord deletes the target table current record in the process. Once the record is deleted, the current selection for the target table is empty. If a record is deleted, the record number can be reused when some new records are created by a client. If there is no current record for target table, DeleteRecord has no effect.

You must test if the record is unlocked before executing DeleteRecord. If the record is locked, the method throws an exception.

Parameters:
table - Table containing the current record to delete
See Also:
4D Open for Java examplet

RelateOne

public void RelateOne(opTable from_table,
                      opTable to_table)
               throws opException
The method RelateOne creates a new selection of records in to_table based on the selection of records in from_table. This routine can only be used if there is a relation from from_table to to_table. This routine can work across several levels of relations.

For example, according to the following table structure:

A call to RelateOne with from_table.mTableNumber=1 and to_table.mTableNumber=2 will select the companies related to the selected records in [Peoples].

Parameters:
from_table - Table starting the relation
to_table - Table ending the relation
See Also:
4D Open for Java examplet

RelateMany

public void RelateMany(opField field)
                throws opException
The method RelateMany creates a selection of records in the Many table based on the selection in the One table. Relation origin is indicated by field.mTableNumber and field.mFieldNumber. This method only works for one level of relation.
Note: If the current selection in the One table is empty while the RelateMany method is executed, it has no effect.

For example, according to the following table structure:


where People is the 2nd table of the database and Companies the 3rd. A call to RelateMany with field.mTableNumber=1 and field.mFieldNumber=5 will select the people working for the currently selected companies.
Note: The One to Many relation does not need to be automatic.
Parameters:
field - Origin field/table for the relation.
See Also:
4D Open for Java examplet

LoadFields

public opDataArray LoadFields(opFieldArray fieldArray)
                       throws opException
The method LoadFields returns an array of data containing the values of the specified fields in the current record. You specify the current record table and the fields you want to retrieve in an opFieldArray data structure.

When you execute LoadFields, 4D Server builds a block of data containing the requested fields. It then sends the entire block to the client workstation. The client workstation must have enough memory to receive the data block.

Parameters:
FieldArray - Array fields with data values.
Returns:
Array of data

RecordsInTable

public void RecordsInTable(opTable table)
                    throws opException
The method RecordsInTable fill the field mRecordsInTable with the total number of records in the target table. If RecordsInTable is used in transaction, the records created during the transaction will be taken into account.
Parameters:
table - Table to count records.
See Also:
4D Open for Java examplet

GotoRecord

public void GotoRecord(opTable table)
                throws opException
The method GotoRecord selects the record record number is passed in table.mRecordNumber as the current record of the target table for the connection. In addition, the routine reduces the current selection to that record. Records are numbered from 0 to n according to their entry order. Note that 4D Server reuses the numbers of the records that have been deleted. You can obtain the record number of one or more records by using SelectionToArray. If the specified record number does not exist, GotoRecord does nothing and throws an exception.
Parameters:
table - Target table.
See Also:
4D Open for Java examplet

FlushBuffers

public void FlushBuffers()
                  throws opException
The method FlushBuffers immediately saves the data buffers to the disk. All changes that have been made to the database are stored on the disk. You usually do not need to call this method, as 4D saves data modification on a regular basis. The database property Flush Data Buffers (in the Design environment), which specifies how often to save, is typically used to control buffer flushing.
Note: 4D integrates a built-in data cache scheme for accelerating I/O operations. The fact that data modifications are, for some time, present in the data cache and not on the disk is transparent to your coding. For example, if you issue a QUERY call, the 4D database engine integrates the data cache in the query operation.

OrderBy

public void OrderBy(opFieldArray fieldArray)
             throws opException
The method OrderBy sorts the current selection of target table, based on the sort definition. Once the sort is completed, the first record of the sorted selection becomes the current record.
Parameters:
fieldArray - Field array on which to set the order

SequenceNumber

public void SequenceNumber(opTable table)
                    throws opException
The method SequenceNumber fill the field table.mSequenceNumber with the next sequence number for that table. The sequence number is unique for each table. The sequence number is incremented on a per table basis when a new record is created, whether or not the number is used. The numbering starts at one.
Parameters:
table - Target table.

CountUsers

public short CountUsers()
                 throws opException
The method CountUsers returns the number of users currently connected to the server. If the server executes any stored procedure(s), CountUsers returns the number of users+1.
Returns:
the number of user
See Also:
4D Open for Java examplet

CountUserProcesses

public short CountUserProcesses()
                         throws opException
The method CountUserProcesses returns the number of user processes currently running. This number excludes the processes managed by 4D Server (User Interface, Client Manager, Cache Manager, Web Server, and Index Builder).
Returns:
Number of user processes
See Also:
4D Open for Java examplet

CountTables

public short CountTables()
                  throws opException
The command CountTables count the number of tables in the database.
Returns:
Number of tables in the database.
See Also:
4D Open for Java examplet

GetTime

public java.util.GregorianCalendar GetTime()
                                    throws opException
The method GetTime returns the time of the 4D Server machine using GregorianCalendar class.
Note: GetTime may also return the date, but do not use it. It is better to use the method GetDate to retrieve the date from the server.
Returns:
Current time on the server.
See Also:
4D Open for Java examplet

GetDate

public java.util.GregorianCalendar GetDate()
                                    throws opException
The method GetDate returns the date of the 4D Server machine using GregorianCalendar class.
If you want to create a Null date, use the following statement:

GregorianCalendar curDate = Null;

Returns:
Current date on the server.
See Also:
4D Open for Java examplet

GetProcessNumber

public void GetProcessNumber(opServerProcess remote_process)
                      throws opException
The method GetProcessNumber loads in the field remote_process.mProcessID the current process number.
Parameters:
remote_process - Process to retrieve number.

CreateRecord

public void CreateRecord(opTable table,
                         opDataArray dataArray)
                  throws opException
Deprecated. Since JOpen 6.7.1, replaced by CreateRecord(opFieldArray, opDataArray).
The method CreateRecord creates a new record for the table specified by table with the contents of dataArray. If you do not specify the values for certain fields, 4D Server initializes the fields to their default values.
The new record becomes the current record and the current selection (a one-record selection).

Parameters:
table - Table for new record.
dataArray - Data to enter.
See Also:
4D Open for Java examplet

CreateRecord

public void CreateRecord(opFieldArray fa,
                         opDataArray dataArray)
                  throws opException
The method CreateRecord creates a new record for the table specified by table with the contents of dataArray. If you do not specify the values for certain fields, 4D Server initializes the fields to their default values.
The new record becomes the current record and the current selection (a one-record selection).
Parameters:
table - Table for new record.
dataArray - Data to enter.
See Also:
4D Open for Java examplet

ModifyRecord

public void ModifyRecord(opTable table,
                         opDataArray dataArray)
                  throws opException
Deprecated. Since JOpen 6.7.1, replaced by ModifyRecord(opFieldArray, opDataArray).
The method ModifyRecord modifies the current record for the table specified by table. If dataArray does not contain all the fields in the table, only the specified fields will be modified.
To use ModifyRecord, the current record must have read/write access and should not be locked.
If there is no current record, then ModifyRecord does nothing. This method does not affect the current selection.

Parameters:
table - Table to modify record.
dataArray - Data to input.
See Also:
4D Open for Java examplet

ModifyRecord

public void ModifyRecord(opFieldArray fa,
                         opDataArray dataArray)
                  throws opException
The method ModifyRecord modifies the specified fields the current record. If dataArray does not contain all the fields in the table, only the specified fields will be modified.
To use ModifyRecord, the current record must have read/write access and should not be locked.
If there is no current record, then ModifyRecord does nothing. This method does not affect the current selection.
Parameters:
fa - Array of field to modify.
dataArray - Data to input.
See Also:
4D Open for Java examplet

GetFieldNumbers

public void GetFieldNumbers(opFieldArray fieldArray)
                     throws opException
The method GetFieldNumbers allows you to retrieve the table and field numbers that correspond to a set of table and field names.
For example, if you were to specify a pair of table and field names:
Table name = People
Field name = Last Name
GetFieldNumbers might return the table and field numbers as:
1
2
indicating that Last Name is the second field in the first table.
All 4D Open for Java routines that deal with table and fields expect table and field numbers. If, in your application, you implement a user interface in which you use the table and field names, you can use GetFieldNumbers to convert the names to numbers.
Parameters:
fieldArray - Field number requested.
See Also:
4D Open for Java examplet

GetProcessList

public opServerProcessArray GetProcessList()
                                    throws opException
The method GetProcessList returns in an array of opProcess objects which contain information about all the processes on the server. This information includes the user name, station name, process name, total time spent, and status of the process. The total time spent is the amount of time the process has used since it started.
Returns:
Array of opProcess objects.
See Also:
4D Open for Java examplet

CreateSet

public void CreateSet(opSet set)
               throws opException
The method CreateSet fills the object set (of opSet type) previously created with the current selection. The current record pointer for the table is saved with set. If the set is used with UseSet, the current selection and current record are restored. As with all sets, there is no sorting order; the set is used with the default order. If a set with the same name already exists, the existing set is cleared by the new set.
Parameters:
set - Set to create.
See Also:
4D Open for Java examplet

CreateEmptySet

public void CreateEmptySet(opSet set)
                    throws opException
The method CreateEmptySet fills the object set (of opSet type) previously created with the current selection. You can then add records to this set with the AddToSet method. If a set with the same name already exists, the existing set is cleared by the new set.
Note: You do not need to use CreateSet before using CreateEmptySet.
Parameters:
set - Empty set to create.

UseSet

public void UseSet(opSet set)
            throws opException
The method UseSet makes the records in set the current selection for the set table. When you create a set, it "remembers" the current record. UseSet retrieves the position of this record and makes it the new current record. If you delete this record before executing UseSet, 4th Dimension selects the first record in the set as the current record. The set commands IntersectionSet, UnionSet, DifferenceSet and AddToSet reset the current record. Also, if you create a set that does not contain the position of the current record, UseSet selects the first record in the set as the current record.
Warning: Remember that a set is a representation of a selection of records when it is created. If the records represented by the set do change, the set may no longer be accurate. Therefore, a set saved to disk should represent a group of records that does not change frequently. A number of things can invalidate a set, such as modifying or deleting a record within the set, or changing the criteria that determined the set.
Parameters:
set - Set to use.
See Also:
4D Open for Java examplet

IsInSet

public boolean IsInSet(opSet set)
                throws opException
The method IsInSet tests whether or not the current record for the table is in set. The IsInSet function returns TRUE if the current record of the table is in set, else it returns FALSE.
Parameters:
set - Set to search in.
Returns:
TRUE = the current record of the table is in set
FALSE = the current record of the table is not in set
See Also:
4D Open for Java examplet

CopySet

public void CopySet(opSet src_set,
                    opSet new_set)
             throws opException
The method CopySet makes a copy of the set src_set into the set new_setname. Both sets can be a process, an interprocess or a local set. In Client/Server mode, interprocess and process sets are maintained on the server machine, while local sets are maintained on the client machines. CopySet allows you to copy sets between the two machines. See the discussion "4D Server and Sets" in the 4D Server Reference manual for more information.
Parameters:
src_set - Set to copy.
new_set - New set.
See Also:
4D Open for Java examplet

AddToSet

public void AddToSet(opSet set,
                     opTable table)
              throws opException
The method AddToSet adds the current record of table to the set. The set must already exist; if it does not, an error occurs. If a current record does not exist for table, AddToSet has no effect.
Parameters:
set - Set receiving the record.
table - Table of the record to add.
See Also:
4D Open for Java examplet

RemoveFromSet

public void RemoveFromSet(opSet set,
                          opTable table)
                   throws opException
The method RemoveFromSet removes the table current record from set. The set must already exist; if it does not, an error occurs. If there is no current record for table, RemoveFromSet has no effect.
Parameters:
set - Target set.
table - Table describing the record to remove.
See Also:
4D Open for Java examplet

DifferenceSet

public void DifferenceSet(opSet src_set,
                          opSet dif_set,
                          opSet dst_set)
                   throws opException
The method DifferenceSet compares src_set and dst_set and excludes all records that are in dst_set from the dif_set. In other words, a record is included in the dif_set only if it is in src_set, but not in dst_set. The following table shows all possible results for a DifferenceSet operation:
src_set dst_set dif_set
Yes No Yes
Yes Yes No
No Yes No
No No No
The dif_set is created by DIFFERENCE. The dif_set replaces any existing set having the same name, including src_set and dst_set. Both src_set and dst_set must be from the same table. The dif_set belongs to the same table as src_set and dst_set.
Parameters:
src_set - Source set.
dif_set - Difference result set.
dst_set - Destination set

UnionSet

public void UnionSet(opSet src_set,
                     opSet un_set,
                     opSet dst_set)
              throws opException
The method UnionSet creates a set that contains all records from src_set and dst_set. The following table shows all possible results of a set UnionSet operation:
src_set dst_set un_set
Yes No Yes
Yes Yes Yes
No Yes Yes
No No No
The un_set is created by UnionSet. The un_set replaces any existing set having the same name, including src_set and dst_set. Both src_set and dst_set must be from the same table. The un_set belongs to the same table as src_set and dst_set. The current record for the result set is the current record from src_set. In Client/Server, interprocess and process sets are maintained on the server machine, while local sets are maintained on the client machines. UnionSet requires the three sets to be on the same machine. Consequently, all or none of the sets must be local. See the discussion "4D Server and Sets" in the 4D Server Reference manual for more information.
Parameters:
src_set - Source set.
un_set - Union result set.
dst_set - Destination set.
See Also:
4D Open for Java examplet

IntersectionSet

public void IntersectionSet(opSet src_set,
                            opSet in_set,
                            opSet dst_set)
                     throws opException
The method IntersectionSet compares src_set and dst_set and selects only the records that are in both. The following table lists all the possible results for a IntersectionSet operation:
src_set dst_set in_set
Yes No No
Yes Yes Yes
No Yes No
No No No
The in_set is created by IntersectionSet. The in_set replaces any existing set having the same name, including src_set and dst_set. Both src_set and dst_set must be from the same table. The in_set belongs to the same table as src_set and dst_set. In Client/Server mode, interprocess and process sets are maintained on the server machine, while local sets are maintained on the client machines. IntersectionSet requires the three sets to be on the same machine. Consequently, all or none of the sets must be local. See the discussion "4D Server and Sets" in the 4D Server Reference manual for more information.
Parameters:
src_set - Source set.
in_set - Difference result set.
dst_set - Destination set.

ClearSet

public void ClearSet(opSet set)
              throws opException
The method ClearSet clears set from memory and frees the used memory. ClearSet does not affect tables, selections or records. To save a set before clearing it, use the CopySet method. Since sets use some memory, remember to delete them when they are no longer used.
Parameters:
set - Set to clear.

SetSemaphore

public boolean SetSemaphore(java.lang.String semaphore_name)
                     throws opException
A semaphore is a flag shared among workstations (each user's computer) or among processes on the same workstation. A semaphore simply exists or does not exist. The methods that each user is running can test for the existence of a semaphore. By creating and testing semaphores, methods can communicate between workstations.

The method SetSemaphore returns TRUE if semaphore_name exists. If semaphore_name does not exist, SetSemaphore creates it and returns FALSE. Only one user at a time can create a semaphore. If SetSemaphore returns FALSE, it means that the semaphore did not exist, but it also means that the semaphore has been set for the process in which the call has been made. SetSemaphore returns FALSE if the semaphore was not set. It also returns FALSE if the semaphore is already set by the same process in which the call has been made. A semaphore name is limited to 30 characters. If you pass a longer string, the semaphore will be tested with the truncated string.

There are two types of semaphores in 4th Dimension: local semaphores and global semaphores.
• A local semaphore is accessible by all processes on the same workstation and only on the workstation. A local semaphore can be created by prefixing the name of the semaphore with a dollar sign ($). You use local semaphores to monitor operations among processes executing on the same workstation. For example, a local semaphore can be used to monitor access to an interprocess array shared by all the processes in your single-user database or on the workstation.
• A global semaphore is accessible to all users and all their processes. You use global semaphores to monitor operations among users of a multi-user database.

Global and local semaphores are identical in their logic. The difference resides in their scope. In 4D Server, global semaphores are shared among all the processes running on all clients. A local semaphore is only shared among the processes running on the client where it has been created.

Parameters:
semaphore_name - Semaphore name.
Returns:
True=semaphore_name exists
False=semaphore_name does not exist

ClearSemaphore

public void ClearSemaphore(java.lang.String semaphore_name)
                    throws opException
The method ClearSemaphore deletes a semaphore previously set by the SetSemaphore method. As a rule, all semaphores that have been created should be cleared. If the semaphores are not cleared, they remain in the memory until the end of the creating process. A process can only clear semaphores that it has created. If you try to clear a semaphore from within a process that did not create it, nothing happens.
Parameters:
semaphore_name - Semaphore name.

GetTableProperties

public void GetTableProperties(opTable table)
                        throws opException
The method GetTableProperties returns detailed information about the target table and its associated fields.

GetTableProperties returns a handle to the table definition in Fdef. To retrieve information about all the tables in the database, count the number of tables by using GetTableNames and then loop once for each of the table. In each loop, call GetTableProperties and retrieve the information for the table.

Parameters:
table - Table to get properties.
See Also:
4D Open for Java examplet

GetTableNames

public void GetTableNames(opTableArray tableArray)
                   throws opException
The method GetTableNames returns the table names in the database.
Parameters:
tableArray - Array to receive the information.
See Also:
4D Open for Java examplet

Search

public opSelection Search(opSearchArray searchArray)
                   throws opException
The method Search performs a search using the search definition whose pointer is passed and returns in opSelection the number of records found in the table.
Parameters:
searchArray - Criteria array.
Returns:
Selection

SearchInSelection

public opSelection SearchInSelection(opSearchArray searchArray)
                              throws opException
The method SearchInSelection performs a search using the search passed in searchArray and returns in opSelection the number of records found in the selection. The difference between SearchInSelection and Search lies in the scope of the search. Search searches for records in the entire table, while SearchInSelection searches for records in the current selection of the file.
The data structures used for SearchInSelection are identical to those used for Search.
Parameters:
searchArray - Criteria array.
Returns:
Selection
See Also:
4D Open for Java examplet

SelectionToArray

public void SelectionToArray(opDataArray[] tabDataArray,
                             opFieldArray tabField)
                      throws opException
The method SelectionToArray returns a buffer containing the concatenated values of the fields you requested for the records in the current selection(s) of the specified table(s). You indicate the fields that you want to retrieve in a ReqFieldRec data structure whose pointer is passed in FieldList. You can retrieve data from the fields in a single target table, as well as from related tables. To retrieve data from related tables, an automatic Many to One relation between the tables must be defined. When you execute a SelectionToArray request, 4D Server goes through the records and builds a block of data containing the requested fields. Then, the entire block is sent to the client workstation. The client workstation must have enough memory to receive the data block.
Parameters:
tabDataArray - Array to receive data.
tabField - Array of fields to use.

ArrayToSelection

public void ArrayToSelection(opDataArray[] tabDataArray,
                             opFieldArray tabField)
                      throws opException
The method ArrayToSelection updates the records in the current selection of a table and/or creates new records in this table. ArrayToSelection is the fastest way to update a selection of records or to create multiple records in the same table.

Unlike SelectionToArray, which allows you to read related fields, ArrayToSelection writes only to fields belonging to the same table. The table to be updated, the fields to be modified and the new values need to be specified in a data buffer created before the call and whose pointer is passed in BufferArray. The creation of the buffer is described later in this section.

Only the fields that you specify are overwritten. The other fields are left unchanged. If you pass more records than there are in the current selection, ArrayToSelection updates the records and then creates additional records. If you pass less records than there are in the current selection, ArrayToSelection updates only the first records in the current selection.

If you only want to create records in a table, you can quickly do so by calling ReduceSelection(opSelection), passing 0 for the number of records, and then calling ArrayToSelection.

If you want to update existing records, you need to set the access mode of the table to read-write.

Parameters:
tabDataArray - Array to receive data.
tabField - Array of fields to use.
See Also:
4D Open for Java examplet

DistinctValues

public opDataArray DistinctValues(opField field)
                           throws opException
The method DistinctValues returns an opDataArray containing the distinct values found in an indexed field for the records in the current selection.

You pass the number of the table to which the field belongs in field. When you execute DistinctValues, 4D Server goes through the index and builds a block of data containing the distinct values in the current selection. It then sends the entire data block to the client workstation. The client workstation must have enough memory to receive the block.

This method does not change the current selection or the current record.

Parameters:
field - Distinct value for this field.
Returns:
tabField Values array.

ExecuteOnServer

public void ExecuteOnServer(opServerProcess remote_process,
                            opVariableArray variableArray)
                     throws opException
The method ExecuteOnServer starts a new process on the Server and returns the process number for that process. You use ExecuteOnServer to start a stored procedure. For more information about stored procedures, see the section Stored Procedures in the 4D Server Reference manual.

If you call ExecuteOnServer on a Client machine, the command returns a negative process number. If you call ExecuteOnServer on the Server machine, ExecuteOnServer returns a positive process number. Note that calling New process on the Server machine does the same thing as calling ExecuteOnServer. If the process could not be created (for example, if there is not enough memory), ExecuteOnServer returns zero (0) and an exception is generated.

Process Method: In method, you pass the name of the process method for the new process. After 4D has set up the context for the new process, it starts executing this method, which therefore becomes the process method.

Process Stack: In stack, you pass the amount of memory allocated for the stack of the process. It is the space in memory used to "pile up" method calls, local variables, parameters in subroutines, and stacked records. It is expressed in bytes; you will usually pass at least 32K (around 32000 bytes), but you can pass more if the process can perform large chain calls (subroutines calling subroutines in cascade). For example, you can pass 200K (around 200000 bytes), if necesary.

Note: The stack is NOT the total memory for the process. Processes share memory for records, interprocess variables, and so on. A process also uses extra memory for storing its process variables. The stack only holds local variables, method calls, parameters in subroutines and stacked records.
You pass the name of the new process in mProcessName. In single-user, this name will appear in the Process List window of the Design environment. In Client/Server, this name will appear in blue in the Stored Procedure list of the 4D Server main window.

A process name can be up to 31 characters long. You can omit this parameter; if you do so, the name of the process will be the empty string.

Warning: Contrary to New Process, do not attempt to make a process local in scope by prefixing its name with the dollar sign ($) while using ExecuteOnServer. This will work in single-user, because ExecuteOnServer acts as New Process in this environment. On the other hand, in Client/Server, this will generate an error.
Parameters to Process Method: Starting with version 6, you can pass parameters to the process method. You can pass parameters in the same way as you would pass them to a subroutine. However, there is a restriction: you cannot pass pointer expressions. Also, remember that arrays cannot be passed as parameters to a method. Upon starting execution in the context of the new process, the process method receives the parameters values in $1, $2, etc.
Note: If you pass parameters to the process method, you must pass the name parameter; it cannot be omitted in this case.
The optional * parameter: Specifying this last parameter tells 4D to first check whether or not a process with the name you passed in name is already running. If so, 4D does not start a new process and returns the process number of the process with that name.
Parameters:
remote_process - Process to launch.
variableArray - Parameters to pass to this call.
See Also:
4D Open for Java examplet

SetProcessVariable

public void SetProcessVariable(opServerProcess remote_process,
                               opVariableArray variableArray)
                        throws opException
The method SetProcessVariable writes the process variables of the destination process whose number is passed in remote_process using the values passed in mProcessID. Each destination variable can be a variable or an array element. For each variable mVariableNames mType, the mType must be of a type compatible with the destination variable, otherwise you may end up with a meaningless value in the variable. In interpreted mode, if a destination variable does not exist, it is created and assigned with the expression. The current process "pokes" the variables of the destination process — the destination process is not warned in any way that another process is writing the instance of its variables.
Tip: If you do not know the ID number of the server process, you can still use the interprocess variables of the server. To do so, use any negative value in process. In other words, it is not necessary to know the ID number of the process to be able to use the SetProcessVariable method with the interprocess variables of the server. This is useful when a stored procedure is launched using the On Server Startup Database Method. As client machines do not automatically know the ID number of that process, any negative value can be passed in the process parameter.
Parameters:
remote_process - Owner process.
variableArray - Variable array to set.
See Also:
4D Open for Java examplet

GetProcessVariable

public void GetProcessVariable(opServerProcess remote_process,
                               opVariableArray variableArray)
                        throws opException
The method GetProcessVariable reads the srcVar process variables (srvVar2, etc.) from the source process whose number is passed in remote_process, and returns their current values in the dstVar variables (dstVar2, etc.) of the current process. Each source variable can be a variable, an array or an array element. However, see the restrictions listed later in this section. In each couple of srcVar;dstVar variables, the two variables must be of compatible types, otherwise the values you obtain may be meaningless.
The current process "peeks" the variables from the source process — the source process is not warned in any way that another process is reading the instance of its variables.
Tip: If you do not know the ID number of the server process, you can still use the interprocess variables of the server. To do so, you can use any negative value in process. In other words, it is not necessary to know the ID number of the process to be able to use the GetProcessVariable method with the interprocess variables of the server. This is useful when a stored procedure is launched using the On Server Startup Database Method. As clients machines do not automatically know the ID number of that process, any negative value can be passed in the process parameter.
Parameters:
remote_process - Owner process.
variableArray - Variable array to get.
See Also:
4D Open for Java examplet

SumField

public double SumField(opField field)
                throws opException
The method SumField returns the sum, which is the total of all values, for the target field in the current selection. If the target field is an indexed field, the index is used to sum the values.
Parameters:
field - Target field.
Returns:
Total of all field values.

AverageField

public double AverageField(opField field)
                    throws opException
The method AverageField returns the arithmetic mean (average) of the target field in the current selection. If the target field is an indexed field, the index is used to find the average.
Parameters:
field - Target field.
Returns:
Arithmetic mean of field.

MaxField

public double MaxField(opField field)
                throws opException
The method MaxField returns the maximum value for the target field in the current selection. If the target field is an indexed field, the index is used to find the maximum value.
Parameters:
field - Target field.
Returns:
Maximum value for the target field.

MinField

public double MinField(opField field)
                throws opException
The method MinField returns the minimum value for the target field in the current selection. If the target field is an indexed field, the index is used to find the minimum value.
Parameters:
field - Target field.
Returns:
Minimum value for the target field.

4D S.A. Copyright 2001

4D S.A.