RecordInsertList Class
The RecordInsertList class provides array insert capabilities in the kernel.
Syntax
class RecordInsertList extends Object
Run On
Called
Methods
Method | Description | |
---|---|---|
add | Adds a record to a RecordInsertList object for subsequent insertion into the database. | |
cancelTimeOut | Cancels a previous method call to the setTimeOut method. (Inherited from Object.) | |
equal | Determines whether the specified object is equal to the current one. (Inherited from Object.) | |
getTimeOutTimerHandle | Returns the timer handle for the object. (Inherited from Object.) | |
handle | Retrieves the handle of the class of the object. (Inherited from Object.) | |
insertDatabase | Inserts all records, that have not already been inserted, in the current RecordInsertList object. | |
new | Creates a new object to hold records for insertion into the database. (Overrides the new Method.) | |
notify | Releases the hold on an object that has called the wait method on this object. (Inherited from Object.) | |
notifyAll | Releases a lock on the object that was issued by the wait method on this object. (Inherited from Object.) | |
objectOnServer | Determines whether the object is on a server. (Inherited from Object.) | |
owner | Returns the instance that owns the object. (Inherited from Object.) | |
setTimeOut | Sets up the scheduled execution of a specified method. (Inherited from Object.) | |
toString | Returns a string that represents the current object. (Inherited from Object.) | |
usageCount | Returns the current number of references, that is, the value of the reference counter, that the object has. (Inherited from Object.) | |
wait | Pauses a process. (Inherited from Object.) | |
xml | Returns an XML string that represents the current object. (Inherited from Object.) |
Top
Remarks
This class allows you to insert more than one record into the database at a time, which reduces communication between the application and the database.
Records are inserted only when the kernel finds the time appropriate, but they are inserted no later than the call to the insertDatabase. add and insertDatabase methods. The RecordInsertList.add and RecordInsertList.insertDatabase methods return the accumulated number of records that are currently inserted, which allows you to keep track of when the records are actually inserted.
The array insert operation automatically falls back to classic record-by-record inserts when non-SQL based tables are used (for example, temporary tables), or when the insert method on the table is overridden (unless it is explicitly discarded).RecordInsertList is similar to RecordSortedList, but it has built-in client/server support (it automatically packs data from one tier to another when needed), and it lacks the sort order features that are available in RecordSortedList.
Examples
The following example uses the RecordInsertList class to copy a bill of materials (BOM) from one BOM to another.
void copyBOM(BOMId _FromBOM, BOMId _ToBOM)
{
RecordInsertList BOMList;
BOM BOM, newBOM;
BOMList = new RecordInsertList(tableNum(BOM));
while select BOM
where BOM.BOMId == _FromBOM
{
newBOM.data(BOM);
newBOM.BOMId = _ToBOM;
BOMList.add(newBOM);
}
BOMList.insertDatabase();
}
Inheritance Hierarchy
Object Class
RecordInsertList Class