ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / Managing databases / HFSQL
  • 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
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
HFSQL error handling help
ODBCNot available with this kind of connection
Overview
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).
WEBDEV - Server code In WEBDEVassisted error handling is not available for static pages, PHP pages, AWP pages and Ajax pages.
iPhone/iPad In the iPhone or iPad applications, you only have the ability to customize the management of errors with HOnError. By default, no error handling window is displayed: error handling is required in all cases..
AndroidAndroid Widget Java In the Java, Android or Android widget applications, you only have the ability to customize the error for automatic reconnection to the HFSQL server with HOnError. Only the window for automatic reconnection to the HFSQL server is displayed by default. For all the other errors, you must process the error.
Related Examples:
WD Detecting HFSQL Errors 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.
WD Managing HFSQL Errors 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 2025
WINDEV Starting with version 2025 Update 1, the look of the windows used by default has been modified.

Remarks

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.
Standard operating mode

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:
    1. The user X edits the form of "California".
    2. The user Y edits the form of "California".
    3. The user X renames the state to "California_01".
    4. 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:
      CrossedModification status conflictModification conflictModification conflict
      DeletedModification status conflictModification status conflictXXXX
      EnabledModification conflictModification conflictModification conflict
      Record on disk
      Record readEnabledCrossedDeleted
  • 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.

    WINDEV 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.
Customization

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.
WINDEVWEBDEV - Server codeWindowsiPhone/iPadHFSQL ClassicHFSQL Client/ServerHyper File 5.5OLE DBNative Connectors (Native Accesses)

Implementation

To implement the assisted custom management of HFSQL errors, you must:
  1. For each type of error, create the procedure, the window or the page used to customize the error. The same window, page or procedure can manage several types of errors. This window, page or procedure must return a specific constant according to the process to perform (see the paragraph below).
  2. Define the customization of errors with HOnError.
WINDEVWEBDEV - Server codeWindowsHFSQL ClassicHFSQL Client/ServerHyper File 5.5OLE DBNative Connectors (Native Accesses)

Examples of windows or pages that can be easily included in your applications

The error windows and pages used by default and presented in the previous paragraphs are supplied (with their WLanguage code) for information.
WINDEV For WINDEV, these windows are available in the "\Programs\Data\Preset Windows\HyperFileSQL - Automatic Help Windows" directory.
WEBDEV - Server code For WEBDEV, these pages are available in the "\Programs\Data\Preset pages\HyperFileSQL - Automatic Help Pages" directory.
Type of errorWINDEV windowWEBDEV page
Duplicate errorDuplicate.wdwDuplicate_WB.wwh
Integrity errorIntegrity.wdwIntegrity_WB.wwh
Password errorPassword.wdwPassword_WB.wwh
Error of modification conflict and error of modification status conflictModif.wdw
ModifStatus.wdw
Modif_WD.wwh
ModifStatus_WB.wwh
Lock errorLock.WDWLock_WB.wwh
Required inputMandatoryInput.WDW
Reindex in progressReindexing.WDWReindexing_WB.wwh
Automatic reconnectionReconnection.WDWReconnection_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".
WINDEVWEBDEV - Server codeWindowsiPhone/iPadHFSQL ClassicHFSQL Client/ServerHyper File 5.5OLE DBNative Connectors (Native Accesses)

Constants used to customize the errors

The procedure, the window or the page used to customize the error must return one of the constants found in the table below.
The corresponding process will be run according to the constant returned.
opCancelThe function that triggered the error returns an error as if the assisted management was disabled.
Note: For lost connection errors, the error is fatal.
opEndProcessThe function that triggered the error returns an error and the current process stops. Equivalent to the following line of code:

IF NOT <HFSQL function> THEN SetFocusAndReturnToUserInput()
AndroidAndroid Widget Java This constant is not available.
opEndProgramThe function that triggered the error returns an error and the program stops. Equivalent to the following line of code:

IF NOT <HFSQL function> THEN EndProgram()
opRelaunchProgramEnds the application and automatically restarts the application.
iPhone/iPad This constant is not available.
opRetryThe function that triggered the error is re-run.
iPhone/iPad This constant is not available.

Remarks:
  • Customization of modification errors: If the procedure, window or page called during the modification conflict returns the constant opTry without doing anything else, the values will be written to the data file without causing a new modification conflict.
  • To differentiate between a modification conflict and a status conflict, use HErrorStatusModification.
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:
HErrorDuplicatesChecks if a duplicate error has occurred.
HErrorIntegrityChecks if an integrity error has occurred.
HErrorLockChecks if a lock error has occurred.
HErrorPasswordChecks if an error has occurred due to a wrong password.
HErrorStatusModificationReturns the status of a record during a modification conflict.

The error details are returned by HErrorInfo.
The assisted management can be re-enabled by HOnError
Remark: 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:
WD Who is locking 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.
WD Managing HFSQL Errors 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.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 02/01/2025

Send a report | Local help