- 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
- xBase/FoxFro
HDelete (Function) In french: HSupprime
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 HCross). 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 the call to HDelete, the record is inserted in the list of records deleted from the data file and it will be re-used by HAdd.
WINDEV, WINDEV Mobile and WEBDEV offer automatic error management for the following 5 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. Remark: To delete all records of a data file, use the HDeleteAll function. Versions 15 and later New in version 15 Versions 17 and later New in version 17 Versions 18 and later New in version 18 Remark: From version 19, HFSQL is the new name of HyperFileSQL. Versions 21 and later New in version 21
// Delete the customer orders HReadSeekFirst(ORDERS, CUSTNUM, ValCustNum) WHILE HFound() = True HDelete() HReadNext() END
// Delete the customer orders FOR EACH ORDER WHERE CUSTNUM = CustNumVal HDelete() END
Syntax
<Result> = HDelete([<Data file> [, <Record number> [, <Options>]]])
<Result>: Boolean - 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, HDelete returns True.
<Data file>: Optional character string (with or without quotes) Name of HFSQL data file or view used. If this parameter corresponds to an empty string (""), the HDelete function manipulates the last data file used by the last HFSQL management function (function starting with the letter H). <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 HRecNum.
<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) |
Remarks Deleting a record from a query Deleting a record from a query can be performed: - in the query result
- in the data files handled by the query (hModifyFile constant used in HExecuteQuery or HExecuteSQLQuery). In this case, the hWithFilter constant is automatically selected.
Regardless of how the request is executed (with or without the hAh constant with SCHTRIME filter), the HDelete function can only be used on single file requests. Caution: - On data files not in HFSQL format, there is no need to specify the hModifyFile constant in HExecuteQuery or HExecuteSQLQuery: 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.
This page is also available for…
|
|
|