<Source>.Cross (Function) In french: <Source>.Raye
 Available only with these kinds of connection
Crosses a record in a data file. The record is deleted logically and it can be retrieved if necessary. The following operations are performed: - the record becomes inactive. The data is stored (which is not the case when a record is deleted by <Source>.Delete).
- the indexes (corresponding to the record keys) are deleted from the index file.
- the memos associated with the record are stored.
This function can be used on the data files, the HFSQL Mobile views or the queries.
// Crosses the record #123 Customer.Cross(123)
// Cross the customer orders Order.ReadSeekFirst(CUSTNUM, ValCustNum) WHILE Order.Found() = True Order.Cross() Order.ReadNext() END
Syntax
<Result> = <Source>.Crossed([<Record number> [, <Options>]])
<Result>: Boolean - True if the record was crossed,
- False if an error occurred (locked record, integrity error, ...). HErrorInfo returns more details.
<Source>: Type corresponding to the specified source Name of HFSQL data file, query or view used. <Record number>: Optional integer Number of the record to cross. If this parameter is not specified (equal to 0 or to the hCurrentRecNum constant), the current record will be crossed. <Options>: Optional constant Configures:- the lock mode applied to the crossed record. If no lock constant is specified, the crossed record is not locked.
| | hLockNo (default value) | No lock: the crossed record will not be locked. | hLockReadWrite | Lock in read/write: the current crossed record cannot be read or re-enabled by another application. | hLockWrite | Lock in write mode: another application can read and consult the current crossed record (<Source>.Read) but cannot re-enable it. Only the current application can re-enable it. |
- the integrity management applied to the crossed record.
A WLanguage error occurs if the two constants are used at the same time. These constants have no effect on the cascading deletion.
Remarks Handling a crossed record - A crossed record will not be read:
- by iteration functions: <Source>.First, <Source>.Last, <Source>.Next, <Source>.Previous, <Source>.ReadFirst, <Source>.ReadLast, <Source>.ReadNext, <Source>.ReadPrevious, <Source>.Forward, <Source>.Backward
- by the search functions: <Source>.SeekFirst, <Source>.ReadSeekFirst, <Source>.SeekLast, <Source>.ReadSeekLast.
- A crossed record can be read by <Source>.Read.
- A crossed record can be re-enabled by <Source>.Modify or <Source>.Write.
- <Source>.State is used to find out the record status (active, crossed, deleted, etc.).
- The physical location of a crossed record can only be reused (by <Source>.Add for example) after:
- the execution of <Source>.Free,
- a reindex operation (with compression).
Number of crossed records <Source>.NbRec is used to find out the number of crossed records in the data file. Remark: For backward compatibility with WEBDEV 1.5/WINDEV 5.5, the number of crossed records can also be returned by the H.NbDel variable. Version of data file If <Source>.Cross is successful, the data file version number is modified. This version number is returned by <Source>.Version. Crossing a record from a query A record can be crossed: Regardless of the query execution mode (with or without the hWithFilter constant), <Source>.Cross can only be used on single-file queries. Caution: - Records cannot be crossed in a query that uses groups or aggregates.
- The management of integrity and duplicates is not performed during the operations on the multi-file queries: it is recommended to use transactions to avoid any problems.
Special cases - Managing locks:
If a lock problem occurs when "crossing" a record (attempt to cross a record locked in write mode for example), the record is not modified and HErrorLock returns True. - Managing the referential integrity
If the management of the referential integrity is enabled (<Connection variable>.SetIntegrity) and if the integrity is not checked during the deletion, <Source>.Cross is not run. HErrorIntegrity must be checked after <Source>.Cross. - Deleted records
<Source>.Cross must not be called on a record that was deleted beforehand.
This page is also available for…
|
|
|
|