PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • 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
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
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 into the list of records deleted from the data file and it will be re-used by HAdd.
PHPOLE DBNative Accesses The deleted record is no longer visible by the browse on the current item. This record will no longer be visible for the browses on the other items once these browse operations have been re-initialized.
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.
Note: To delete all records from a data file, use HDeleteAll.
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
WINDEVWEBDEV - Server codeiPhone/iPadWindows MobileUniversal Windows 10 AppJavaPHPAjaxHFSQLHFSQL 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
Syntax
<Result> = HDelete([<File Name> [, <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.
<File Name>: Optional character string (with or without quotes)
Name of HFSQL data file or view used. If this parameter corresponds to an empty string (""), HDelete handles the last data file used by the last function for HFSQL management (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.
OLE DBNative Accesses This parameter must correspond to the current record number (hCurrentRecNum constant).
Java Access by JDBC: This parameter must correspond to the current record number (hCurrentRecNum constant).
<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 by JDBC: This parameter is ignored.
Remarks
WINDEVWEBDEV - Server codeiPhone/iPadWindows MobileUniversal Windows 10 AppJavaPHPAjaxExternal languageHFSQLHFSQL Client/ServerHyper File 5.5

Handling a deleted record

WINDEVWEBDEV - Server codeiPhone/iPadWindows MobileUniversal Windows 10 AppJavaPHPAjaxExternal languageHFSQLHFSQL 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 backward compatibility with Hyper File 5.5, the H.NbDel variable can also be used to find out the number of deleted records.

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 the runtime mode of query (with or without the hWithFilter constant), HDelete can only be used on the single-file queries.
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.
See Modifying the query content for more details.
WINDEVWEBDEV - Server codeiPhone/iPadWindows MobileUniversal Windows 10 AppJavaPHPAjaxExternal languageHFSQLHFSQL Client/ServerHyper File 5.5

Version of data file

If HDelete is successful, the version number of data file is modified . This version number is returned by HVersion.
WINDEVWEBDEV - Server codeiPhone/iPadWindows MobileUniversal Windows 10 AppJavaPHPAjaxExternal languageHFSQLHFSQL 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 performances, the reduction of file size being costly in time.
However, if the size of a data file must be reduced after several deletions, you have the ability to re-index it (via HIndex, WDMap or HFSQL Control Center)
WINDEVWEBDEV - Server codeiPhone/iPadUniversal Windows 10 AppJavaAjaxExternal languageHFSQLHFSQL Client/ServerHyper File 5.5OLE DBNative Accesses

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 - Server codeWindows MobileAjaxNative Accesses

xBase/FoxFro

HDelete and HCross have the same effect: the record is crossed but it is not deleted. Therefore, the record can be re-enabled by 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: HIndex is not available
Components
WINDEVWEBDEV - Server code wd230hf.dll
Windows Mobile wp230hf.dll
Java wd230java.jar
Linux wd230hf.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment