- Handling a deleted record
- Number of deleted records
- Deleting a record from a query
- Version of data file
- Size of the data file
- Deletion and lock
In french: <Source>.Supprime
Not available with this kind of connection
Deletes a record from a data file (query or view). The record is deleted logically and physically. It cannot be restored (unlike the records crossed by <Source>.Cross
The following operations are performed:
- the record is deleted: the record is inactive and it is not referenced in the index anymore. The data is not kept.
- the indexes (corresponding to the record keys) are deleted from the index file.
- the memos associated with the record are deleted from the memo file.
After running <Source>.Delete
, the record is inserted in the list of deleted records of the data file and will be re-used by <Source>.Add
WINDEV, WINDEV Mobile and WEBDEV propose an automatic management of errors for the following types of errors: Duplicate error, integrity error, password error, modification conflict error and status error during modification conflict, lock error. See Assisted management of HFSQL errors
for more details.
// Delete the customer orders
WHILE Order.Found() = True
// Delete the customer orders
FOR EACH Order where CustNum = CustNumVal
<Result> = <Source>.Delete([<Record number> [, <Options>]])
- True if the record was deleted,
- False if a problem occurred (locked record, etc. (see the special cases)). HErrorInfo is used to identify the error.
If the record to delete is already deleted, <Source>.Delete returns True.
<Source>: Type corresponding to the specified source
Name of HFSQL data file or view used.
<Record number>: Optional integer
Number of the record to delete. If this parameter is not specified (if it is equal to 0 or to the hCurrentRecNum constant), the current record will be deleted. However, the current record will remain the deleted record.
CAUTION: Do not confuse the record number with the automatic identifier associated with the record.
In most cases, these two numbers are not identical. The record number is returned by <Source>.RecNum
This parameter must correspond to the current record number (hCurrentRecNum
Access by JDBC: This parameter must correspond to the current record number (hCurrentRecNum
<Options>: Optional constant
Configures the integrity management performed on the deleted record.
|hIgnoreIntegrity||Ignores the integrity check for this operation, even if the automatic integrity check is enabled (HSetIntegrity)|
This parameter is ignored.
Access by JDBC: This parameter is ignored.
Handling a deleted record
- A deleted record will not be read:
- by the browse 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 deleted record can be read by <Source>.Read. Its content will be incomplete or inconsistent.
- The physical location of a deleted record can be immediately re-used by <Source>.Add for example.
Deleting a record from a query
Deleting a record from a query can be performed:
Regardless of the query execution mode (with or without the hWithFilter constant), <Source>.Delete can only be used on single-file queries.
- On data files not in HFSQL format, there is no need to specify the hModifyFile constant in <Fichier HFSQL>.ExécuteRequête or <Fichier HFSQL>.ExécuteRequêteSQL: the data files taking part in the query are automatically modified when modifying the query result.
- No record can be deleted from a query that is using the groups or aggregates.
- The management of integrity and duplicates is not performed during the operations on the multi-file queries: we recommend that you use the transactions to avoid any problem.
have the same effect: the record is crossed but it is not deleted. Therefore, the record can be re-enabled by <Source>.Modify
. In this case, <Source>.State
returns the hStateCrossed
constant for a deleted record (instead of hStateDel
To physically delete the crossed records, you must use <Source>.Index
This page is also available for…