|
4D S.A. Copyright 2001 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--j4d.open.opStd | +--j4d.open.opProcess
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 |
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 |
public java.lang.String mUserName
public java.lang.String mStationName
public java.lang.String mMethodName
public java.lang.String mProcessName
public int mTimeSpent
public int mStackSize
public byte mUnique
Constructor Detail |
public opProcess()
Method Detail |
public opSelection AllRecords(opTable table) throws opException
Table
- to extract the selectionpublic void DeleteSelection(opSelection selection) throws opException
selection
- Selection to deletepublic void RecordsInSelection(opSelection selection) throws opException
selection
- Selection to count the recordspublic void GotoSelectedRecord(opSelection selection) throws opException
selection
- Selection in which to movepublic void ReduceSelection(opSelection selection) throws opException
Note: A quick way to make the current selection empty is to call ReduceSelection and pass 0 in mRecordNumber.
selection
- Selection to reducepublic void CopyNamedSelection(opSelection selection) throws opException
selection
- Destination selectionpublic void CutNamedSelection(opSelection selection) throws opException
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.
selection
- Destination selectionpublic void UseNamedSelection(opSelection selection) throws opException
• 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.
selection
- Destination selectionpublic void ClearNamedSelection(opSelection selection) throws opException
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.
selection
- Selection to clearpublic void ReadOnly(opTable table) throws opException
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.
table
- Table to set in ReadOnly modepublic void ReadWrite(opTable table) throws opException
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.
table
- Table to set in ReadWrite modepublic void UnloadRecord(opTable table) throws opException
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.
table
- Table containing the current record to unloadpublic void StartTransaction() throws opException
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.
public void ValidateTransaction() throws opException
public void CancelTransaction() throws opException
public void DeleteRecord(opTable table) throws opException
You must test if the record is unlocked before executing DeleteRecord. If the record is locked, the method throws an exception.
table
- Table containing the current record to deletepublic void RelateOne(opTable from_table, opTable to_table) throws opException
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].
from_table
- Table starting the relationto_table
- Table ending the relationpublic void RelateMany(opField field) throws opException
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:
Note: The One to Many relation does not need to be automatic.
field
- Origin field/table for the relation.public opDataArray LoadFields(opFieldArray fieldArray) throws opException
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.
FieldArray
- Array fields with data values.public void RecordsInTable(opTable table) throws opException
table
- Table to count records.public void GotoRecord(opTable table) throws opException
table
- Target table.public void FlushBuffers() throws opException
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.
public void OrderBy(opFieldArray fieldArray) throws opException
fieldArray
- Field array on which to set the orderpublic void SequenceNumber(opTable table) throws opException
table
- Target table.public short CountUsers() throws opException
public short CountUserProcesses() throws opException
public short CountTables() throws opException
public java.util.GregorianCalendar GetTime() throws opException
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.
public java.util.GregorianCalendar GetDate() throws opException
GregorianCalendar curDate = Null;
public void GetProcessNumber(opServerProcess remote_process) throws opException
remote_process
- Process to retrieve number.public void CreateRecord(opTable table, opDataArray dataArray) throws opException
CreateRecord(opFieldArray, opDataArray)
.
table
- Table for new record.dataArray
- Data to enter.public void CreateRecord(opFieldArray fa, opDataArray dataArray) throws opException
table
- Table for new record.dataArray
- Data to enter.public void ModifyRecord(opTable table, opDataArray dataArray) throws opException
ModifyRecord(opFieldArray, opDataArray)
.
table
- Table to modify record.dataArray
- Data to input.public void ModifyRecord(opFieldArray fa, opDataArray dataArray) throws opException
fa
- Array of field to modify.dataArray
- Data to input.public void GetFieldNumbers(opFieldArray fieldArray) throws opException
fieldArray
- Field number requested.public opServerProcessArray GetProcessList() throws opException
public void CreateSet(opSet set) throws opException
set
- Set to create.public void CreateEmptySet(opSet set) throws opException
Note: You do not need to use CreateSet before using CreateEmptySet.
set
- Empty set to create.public void UseSet(opSet set) throws opException
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.
set
- Set to use.public boolean IsInSet(opSet set) throws opException
set
- Set to search in.public void CopySet(opSet src_set, opSet new_set) throws opException
src_set
- Set to copy.new_set
- New set.public void AddToSet(opSet set, opTable table) throws opException
set
- Set receiving the record.table
- Table of the record to add.public void RemoveFromSet(opSet set, opTable table) throws opException
set
- Target set.table
- Table describing the record to remove.public void DifferenceSet(opSet src_set, opSet dif_set, opSet dst_set) throws opException
src_set | dst_set | dif_set |
Yes | No | Yes |
Yes | Yes | No |
No | Yes | No |
No | No | No |
src_set
- Source set.dif_set
- Difference result set.dst_set
- Destination setpublic void UnionSet(opSet src_set, opSet un_set, opSet dst_set) throws opException
src_set | dst_set | un_set |
Yes | No | Yes |
Yes | Yes | Yes |
No | Yes | Yes |
No | No | No |
src_set
- Source set.un_set
- Union result set.dst_set
- Destination set.public void IntersectionSet(opSet src_set, opSet in_set, opSet dst_set) throws opException
src_set | dst_set | in_set |
Yes | No | No |
Yes | Yes | Yes |
No | Yes | No |
No | No | No |
src_set
- Source set.in_set
- Difference result set.dst_set
- Destination set.public void ClearSet(opSet set) throws opException
set
- Set to clear.public boolean SetSemaphore(java.lang.String semaphore_name) throws opException
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.
semaphore_name
- Semaphore name.public void ClearSemaphore(java.lang.String semaphore_name) throws opException
semaphore_name
- Semaphore name.public void GetTableProperties(opTable table) throws opException
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.
table
- Table to get properties.public void GetTableNames(opTableArray tableArray) throws opException
tableArray
- Array to receive the information.public opSelection Search(opSearchArray searchArray) throws opException
searchArray
- Criteria array.public opSelection SearchInSelection(opSearchArray searchArray) throws opException
searchArray
- Criteria array.public void SelectionToArray(opDataArray[] tabDataArray, opFieldArray tabField) throws opException
tabDataArray
- Array to receive data.tabField
- Array of fields to use.public void ArrayToSelection(opDataArray[] tabDataArray, opFieldArray tabField) throws opException
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.
tabDataArray
- Array to receive data.tabField
- Array of fields to use.public opDataArray DistinctValues(opField field) throws opException
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.
field
- Distinct value for this field.public void ExecuteOnServer(opServerProcess remote_process, opVariableArray variableArray) throws opException
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.
remote_process
- Process to launch.variableArray
- Parameters to pass to this call.public void SetProcessVariable(opServerProcess remote_process, opVariableArray variableArray) throws opException
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.
remote_process
- Owner process.variableArray
- Variable array to set.public void GetProcessVariable(opServerProcess remote_process, opVariableArray variableArray) throws opException
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.
remote_process
- Owner process.variableArray
- Variable array to get.public double SumField(opField field) throws opException
field
- Target field.public double AverageField(opField field) throws opException
field
- Target field.public double MaxField(opField field) throws opException
field
- Target field.public double MinField(opField field) throws opException
field
- Target field.
|
4D S.A. Copyright 2001 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |