AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Administrar bases de datos / HFSQL / Funciones HFSQL
  • 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
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
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 rendered inactive and is no longer referenced in the index. 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 HDelete, the record is inserted in the list of deleted records and will be reused by HAdd.
PHPOLE DBConectores Nativos The deleted record is no longer visible in the iteration on the current item. This record will no longer be visible in iterations on other items if these iterations are reinitialized.


WINDEV, WINDEV Mobile and WEBDEV offer automatic error handling for the following 5 types of error: Duplicate error, Integrity error, Password error, Modification conflict and status error during modification conflict, Blocking error. For more details, see HFSQL error handling help.
Note To delete all records in a data file, use HDeleteAll.
Ejemplo
WINDEVWEBDEV - Código ServidoriPhone/iPadJavaPHPAjaxHFSQL ClassicHFSQL Client/ServerHyper File 5.5
// Deletes the record #123 
HDelete(Customer, 123)
// 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
Sintaxis
<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
Name of HFSQL data file or view used. If this parameter is an empty string (""), HDelete manipulates the last data file used by the last HFSQL function (function starting with "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 automation identifier associated with the Record.
In most cases, these two numbers are not identical. The record number is returned by HRecNum.
OLE DBConectores Nativos This parameter must correspond to the current record number (hCurrentRecNum constant).
Java JDBC access: This parameter must correspond to the current record number (constant hNumEnrEnCours).
<Options>: Optional constant
Configures the integrity management performed on the deleted record.
hIgnoreIntegrityIgnores the integrity check for this operation, even if the automatic integrity check is enabled (HSetIntegrity)
PHP This parameter is ignored.
Java Access through JDBC: This parameter is ignored.
Observaciones
WINDEVWEBDEV - Código ServidoriPhone/iPadJavaLenguaje ExternoPHPAjaxHFSQL ClassicHFSQL Client/ServerHyper File 5.5

Handling a deleted record

WINDEVWEBDEV - Código ServidoriPhone/iPadJavaLenguaje ExternoPHPAjaxHFSQL ClassicHFSQL Client/ServerHyper File 5.5

Number of deleted records

HNbRec is used to find out the number of records deleted from the data file.
Note For compatibility with Hyper File 5.5, it is also possible to find out the number of records deleted using the H.NbSup variable.

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 query is executed (with or without the constant hWithFilterconstant), the HDelete function can only be used on single-file requests.
Caution:
  • On non-HFSQL data files, there is no need to specify the constant hModifiesFile in functions HExecuteQuery or HExecuteSQLQuery: data files contributing to the query are automatically modified when the query result is modified.
  • Records cannot be deleted from a query that uses groups or aggregates.
  • Integrity and duplicates are not managed by operations on multi-file queries: it is advisable to use transactions to avoid any problems.
For more details, see Modifying the query content.
WINDEVWEBDEV - Código ServidoriPhone/iPadJavaLenguaje ExternoPHPAjaxHFSQL ClassicHFSQL Client/ServerHyper File 5.5

Version of data file

If HDelete is successful, the data file version number is modified. This version number is returned by HVersion.
WINDEVWEBDEV - Código ServidoriPhone/iPadJavaLenguaje ExternoPHPAjaxHFSQL ClassicHFSQL Client/ServerHyper File 5.5

Size of the data file

The deletion of one or more records has no incidence on the total file size on disk. The locations left empty in the data files by the deletions will be re-used during the next additions of records (HAdd). This feature is used to get better performance, the reduction of file size being costly in time.
However, if after many deletions it is necessary to reduce the size of a data file, it can be reindexed (via HIndex, WDMap or the HFSQL Control Center).
WINDEVWEBDEV - Código ServidoriPhone/iPadJavaLenguaje ExternoAjaxHFSQL ClassicHFSQL Client/ServerHyper File 5.5OLE DBConectores Nativos

Deletion and lock

If a lock problem occurs when "deleting" a record (attempt to delete a record locked in write mode for example), the record is not deleted and HErrorLock returns True.
WINDEVWEBDEV - Código ServidorAjaxConectores Nativos

xBase/FoxFro

The function HDelete function has the same effect as HCross: the record is scratched, not deleted. Therefore, the record can be re-enabled using HModify. In this case, HState returns the hStateCrossed constant for a deleted record (instead of hStateDel).
To physically delete the crossed records, you must use HIndex.
FoxPro files The HIndex function is not available
Componente: wd300hf.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local