- Overview
- Principle of assisted management
- Principle
- Remarks
- Standard operating mode
- Duplicate error
- Integrity error
- Password error
- Error of modification conflict and error of modification status conflict
- Lock error
- Required input (database accessed via OLE DB)
- Reindexing in progress
- Automatic reconnection to HFSQL server
- Customization
- The different solutions
- Implementation
- Examples of windows or pages that can be easily included in your applications
- Constants used to customize the errors
- Disabling the assisted management
- Overview
- Implementation
HFSQL error handling help
Not available with this kind of connection
WINDEV and WEBDEV include a module for assisted management of HFSQL errors. A specific window or page is automatically displayed for the following types of errors: The different error cases that may occur must be checked after each HFSQL function that handles a data file. If this check is not performed, a WLanguage error is generated and the application stops. HOnError is used to customize the assisted management of errors or to disable this management. For each type of error, you can: - Manage this error via a specific window/page or via a procedure (for more details, see Managing an HFSQL error via a procedure).
- Disable the assisted management and manage the error through programming (like in WINDEV 5.5).
Related Examples:
|
Training (WINDEV): WD Detecting HFSQL Errors
[ + ] This educational example, powered by WINDEV, presents the module for assisted management of HFSQL errors: Duplicate, Integrity, Lock, Password, Modification conflict. This example presents: - the default operating mode, - the different methods for customizing this assisted management.
|
|
Training (WINDEV): WD Managing HFSQL Errors
[ + ] The "WD Managing HFSQL Errors" example presents the management of HFSQL errors (duplicate, integrity). This example explains how to customize the process when an error occurs.
|
Principle of assisted management Principle To simplify data file management programming, the most common types of errors are automatically managed by the HFSQL engine. This automatic management helps the user process the error. In most cases, the error is caused by a problem involving the data entered. This automatic management is proposed by default and it can be customized or disabled. New in version 2025Remarks The assisted management of errors is available for data files in Hyper File Classic and Hyper File 5.5 format, for data files used via a Native Connector (also called Native Access) and for data files used via an OLE DB provider. If your data files are handled via an OLE DB provider, only the following elements are managed: - The duplicate errors
Warning: Some duplicate errors may not be recognized as such by OLE DB access.. These errors will not be managed as duplicates errors but they will be considered as being fatal errors. Example: the WINDEV analysis and the description of the external database are not in phase, and the description of the data file in the analysis does not contain all the unique keys of the data file defined on the database. - Required input errors
Warning: the mandatory entry error only appears if the OLE DB provider indicates that the field is associated with the "NULL forbidden" property.. Otherwise, the error will be processed like a fatal error.
If your data files are handled via a Native Connector, the management of mandatory passwords is not available. Duplicate error - Error cause
The user adds a record for which the value of a unique key already exists. For example, the department number and its name are defined as unique keys for the Cedex data file in the analysis. A duplicate error occurs when adding a state whose number is already found. - Default assisted management available in WINDEV, WINDEV Mobile and WEBDEV
If a duplicate error is detected, a window or a page is displayed, asking the user to modify the value of the record that caused the error. - Processing the error
Check the result of HErrorDuplicates after each call to an HFSQL function that may trigger a duplicate error (HAdd or HModify for example). The error details are returned by HErrorInfo.
Integrity error - Error cause
The user attempts to add a record without respecting the integrity constraints defined between data files at the analysis level. For example, the CEDEX, DEPARTEMENT and REGION data files are linked together for analysis purposes. These links comply with the relational integrity constraints. An integrity error occurs when adding a state without creating the corresponding region. - Default assisted management available in WINDEV, WINDEV Mobile and WEBDEV
When an integrity error occurs, a window or a page is displayed, asking the user to cancel the operation or to modify the data entered. - Processing the error
Check the result of HErrorIntegrity after each call to an HFSQL function that may trigger a duplicate error (HAdd or HModify for example). The error details are returned by HErrorInfo.
Password error - Error cause
The program attempts to manipulate a password-protected data file (open, first read, etc.). The password was not specified through programming: a password error occurs. - Default assisted management available in WINDEV, WINDEV Mobile and WEBDEV
When a password error is detected, a window or page is displayed allowing the user to enter the password for the data file. - Processing the error
Check the result of the HErrorPassword function after each HFSQL function that may cause a password error (HOpen for example, or the first HFSQL function that manipulates the data file). The error details are returned by HErrorInfo.
Error of modification conflict and error of modification status conflict - Error cause
When using an application in network, conflicts may occur because of conflicting data entered by the different users. For example:- The user X edits the form of "California".
- The user Y edits the form of "California".
- The user X renames the state to "California_01".
- The user Y modifies the name of the state ("California_02") and saves. A modification conflict occurs during this backup.
A modification conflict occurs. A conflict of modification status occurs when the form is deleted by the user X for example. The different cases are presented in the table below:
| | | | Crossed | Modification status conflict | Modification conflict | Modification conflict | Deleted | Modification status conflict | Modification status conflict | XXXX | Enabled | Modification conflict | Modification conflict | Modification conflict | Record on disk | Record read | Enabled | Crossed | Deleted |
- Default assisted management available in WINDEV, WINDEV Mobile and WEBDEV
- If a conflict occurs when a record is modified, a window is displayed, proposing the possible values for the record:
- the value read from the data file (before modification).
- the value modified by another user.
- the value entered by the current user.
Then, the user can choose the value of the item that will be saved.
- If a conflict occurs when modifying a record, a window is displayed, allowing the user to:
- re-enable the deleted data.
- keep the data in its current status.
Then, the user can choose the value of the item that will be saved.
- Processing the error
- For modification conflict errors, check the result of HErrorModification after each call to an HFSQL function that may trigger this error (HModify for example). The error details are returned by HErrorInfo.
- For modification status conflict errors, check the result of HErrorStatusModification after each call to an HFSQL function that may trigger this error (HModify for example). The error details are returned by HErrorInfo.
Lock error - Error cause
In a network application, it is possible to block a record or a data file in order to carry out specific operations, for example. A lock error occurs when a network computer tries to access a locked record. - Default assisted management available in WINDEV, WINDEV Mobile and WEBDEV
In the event of a blocking error, the HFSQL engine automatically handles blocking (checking whether the data file is blocked, handling the block). A window/page appears, informing the user that the record or data file is blocked and offering to retry or cancel the operation. In case of cancellation, the application continues to run as usual.
- Processing the error
Check the result of HErrorLock after each call to an HFSQL function that may trigger a lock error.
Required input (database accessed via OLE DB) - Error cause
Some fields in the manipulated data file must have a value. If no value was entered, a required input error message appears. - Default assisted management available in WINDEV, WINDEV Mobile and WEBDEV
If no value was entered, the HFSQL engine automatically opens a window to enter the required value. A window is displayed, indicating that the item must be filled and allowing the user to type the item value. - Processing the error
The error number associated with this problem is 70710 Mandatory field value. These error numbers are returned by HError.
Reindexing in progress - Error cause
The manipulated data file is currently being reindexed. It is impossible to manipulate the data file (read, write, etc.) during this reindexing. - Default assisted management available in WINDEV, WINDEV Mobile and WEBDEV
A window is displayed, indicating that the data file is currently reindexed (also called reorganization). This window is displayed during the entire reindex operation and it cannot be closed. A progress bar indicates the status of re-index operation.
Remark: To avoid blinking effects, the supplied reindexing windows (automatic window or maintenance by another station) are displayed only if reindexing is likely to take more than 2 seconds.. In this case, the reindex windows are displayed after 0.7 seconds. This mechanism is not applied to the windows used by HOnError. To include this mechanism in your custom windows, see the code of the "Reindex.wdw" window available in the "\HyperFileSQL - Automatic Help Windows" directory. - Processing the error
The error number associated with this problem is 70720 Re-indexing is in progress on the data file These error numbers are returned by HError.
Automatic reconnection to HFSQL server Automatic connection resumption is a very useful feature, as it deals with the aspect of disconnection during use. Typically, this problem arises with devices with unstable connections to the server (mobile devices in particular, Wi-Fi, 3G, etc.). In a Wi-Fi connection, for example, the link between a remote device and the server may be interrupted for a short time.. This type of break may also happen on the standard wired networks. Once the application is "connected" again, it is useful to resume the application where the communication was interrupted. The buffers must be properly specified. With the automatic resuming of the connection, all the buffers are stored and reassigned. The application can then continue to run without error, as if the connection had not been interrupted. - Error cause
The application hast lost one or more connections with one or more HFSQL servers. The possible reasons can be:- loss of GPRS link,
- intervention on the network,
- update of the server,
- crash of the server,
- standby of the client computer.
- Default assisted management available in WINDEV, WINDEV Mobile and WEBDEV
When the client application does not have access to the server anymore, a window or a page is automatically displayed, indicating that the connection with the server is no longer available. This window tries to reconnect on a regular basis. When the server is available again, the reconnection is automatically performed and the window disappears. The user can continue to use the application. To implement the automatic reconnection, you must:- recompile the client application (version greater than 15).
- install the HFSQL Client/Server server (version greater than 15).
- Processing the error
This error is a fatal error.
Caution: Automatic reconnection is not possible in the following cases: - The application includes a transaction in progress.
- The application has blocked a data file (read/write).
- The application blocked a read/write data file and another application modified a record in this data file while the application was not connected.
- Blocking was performed by one of the following functions: HFirst, HNext, HPrevious or HLast.
The different solutions WINDEV, WEBDEV and WINDEV Mobile give you the ability to customize the management of HFSQL errors. You can: - use the custom procedures.
A specific procedure of your application is automatically run as soon as an HFSQL error occurs. Note: You can define a procedure for each data file and each type of error. - use windows or customized pages: the standard windows and pages of the HFSQL engine are replaced by windows or pages from your application.
Note: You can define a window/page for each data file and each error type.
| | | Type of error | WINDEV window | WEBDEV page | Duplicate error | Duplicate.wdw | Duplicate_WB.wwh | Integrity error | Integrity.wdw | Integrity_WB.wwh | Password error | Password.wdw | Password_WB.wwh | Error of modification conflict and error of modification status conflict | Modif.wdw ModifStatus.wdw | Modif_WD.wwh ModifStatus_WB.wwh | Lock error | Lock.WDW | Lock_WB.wwh | Required input | MandatoryInput.WDW | | Reindex in progress | Reindexing.WDW | Reindexing_WB.wwh | Automatic reconnection | Reconnection.WDW | Reconnection_WB.wwh |
These windows or pages can be included in your projects, they can be customized, translated and passed as parameter to HOnError. To include these windows/pages in your projects: in the "Project" pane, in the "Project" group, pull down "Import" and select "WINDEV/WEBDEV/WINDEV Mobile elements and their dependencies". Disabling the assisted management Overview WINDEV, WEBDEV and WINDEV Mobile allow you to entirely disable the system for automatic management of errors. In this case, the different error cases that may occur must be checked in the application. If this check is not performed, a WLanguage error is generated and the application stops. Implementation To entirely disable the automatic management of errors, simply use HOnError and specify an empty string for the name of the window, page or procedure. In this case, after each HFSQL function that can cause an error, it is necessary to check the result of one or more of the following functions: The error details are returned by HErrorInfo. The assisted management can be re-enabled by HOnErrorRemark: For other errors (modification, mandatory entry, re-indexing in progress), no check is necessary.. The error numbers associated with these problems are: - 70700: Modification conflict
- 70710 Mandatory field value
- 70720 Re-indexing of the data file is in progress.
These error numbers are returned by HError.
Related Examples:
|
Training (WINDEV): WD Who is locking
[ + ] This example explains how to notify to the users of a HFSQL database in network "who" is locking an inaccessible record. The following topics are presented in this example: 1/ management of concurrent accesses 2/ automatic refresh by timer 3/ management of a "system" file to store information about the locks. Summary of the example supplied with WINDEV: This example, powered by WINDEV, includes 2 projects: - WD Who is locking: test application that manages a "client" file in network - WD Supervisor of locks: management tool used to view the existing locks and to force the unlocking if necessary. An edit form may have been left opened by a user for quite a long time ; this may interfere with the other users. The 'Free' button sends a message to the relevant user and asks him to free the record. The 'Unlock!' button is used to force the unlocking of the record. Caution: This operation will send a message forcing the closing of the application that performed the lock.
|
|
Training (WINDEV): WD Managing HFSQL Errors
[ + ] The "WD Managing HFSQL Errors" example presents the management of HFSQL errors (duplicate, integrity). This example explains how to customize the process when an error occurs.
|
This page is also available for…
|
|
|