ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / HFSQL / HFSQL functions
  • Characteristics of created data file
  • Additional files created
  • Managing passwords
  • Managing fatal errors when creating a data file
  • Managing non-Latin character sets
  • Replication: Range of identifiers
  • Priority for defining the location of log files
  • Creating an existing table
  • Constraints for referential integrity
  • OLE DB Oracle: Creating a table containing a binary memo
  • OLE DB: Creating a table containing automatic identifiers
  • Managing indexes
  • Creating the data file from its description
  • DATE and TIME items with the Native SQL Server Connector
  • HCreation and Native SQLite Connector
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Creates an empty data file (.FIC extension) with the index file and the memo file if necessary.
This function can also be used to delete all records from a data file. In this case, the record in memory is not canceled. To initialize it, use HReset.
Remark: The automatic creation of non-existing data files can be enabled in the project description ("Files" tab of the project description, "Automatically create the data files when they are opened"). HCreation is automatically used if the data file does not exist when it is handled for the first time.
WINDEVHFSQL Classic If the data file is logged, you can specify the location of the log files.
HFSQL Client/Server If integrity constraints have been defined and if they are supported, the links are updated on the server.
// Create the Orders data file (described in the analysis)
HCréation(Orders)
Syntax
<Result> = HCreation(<Data file> [, <Password> [, <Path of the JNL file> [, <Path of the JournalOperation file> [, <Option>]]]])
<Result>: Boolean
  • True if the data file was created,
  • False if a problem occurs. HError is used to identify the error. If a fatal error occurs, a specific process is required to continue the program and to check whether the data file was created (see the Notes).
<Data file>: Character string
Name of data file to create.
Native Connectors (Native Accesses) MySQL: the table name must contain no accented character (for example: "ÉlanFile"). This is a problem specific to MySQL (tested on versions 3.23.52-max-nt and 3.23.47-max-nt of the MySQL server).
<Password>: Optional character string
  • Password associated with the data file.
    HFSQL ClassicHFSQL Client/Server The password of HFSQL files is not case-sensitive.
  • Empty string ("") if no password is used.
<Path of the JNL file>: Optional character string
Access path to the JNL file associated with the logged data file. This parameter is only taken into account if the data file is logged. In this case, <File name>JNL.fic will be created at the specified location.
HFSQL Client/Server This parameter must not be specified. In HFSQL Client/Server, the path of JNL file is defined and it cannot be modified.
Java Access by JDBC: This parameter is ignored.
<Path of the JournalOperation file>: Optional character string
Access path to JournalOperation file and to JournalIdentification file associated with the logged file. The JournalOperation file contains all the operations performed on the file with logs. This parameter is only taken into account if the data file is logged.
HFSQL Client/Server This parameter must not be specified. In HFSQL Client/Server, the path of operation file is defined and it cannot be modified.
Java Access by JDBC: This parameter is ignored.
<Option>: Optional Integer constant
Options for creating the data file:
hChangeCharsetThe character set defined by ChangeCharset will be taken into account in the new data file. Sorts, searches, ... on string keys (strings, characters, date and time) will be performed according to this character set.
hNoLinkManagement of integrity: The links are not updated on the server (creation, modification or deletion).
Reminder: by default, the links are updated on the server when creating a data file.
HFSQL Client/Server This constant is only available for HFSQL Client/Server.
Java Access by JDBC: This parameter is ignored.
Remarks
WINDEVUniversal Windows 10 AppJavaHFSQL ClassicHFSQL Client/ServerStored proceduresHyper File 5.5OLE DBNative Connectors (Native Accesses)

Characteristics of created data file

The characteristics of created data file are as follows:
  • Data file name:
    Physical name defined during the file description in the data model editor. This name can be modified by HChangeName before creating the data file.
  • Directory of data file:
    Directory defined during the file description in the data model editor. This directory can be changed with HChangeDir and HSubstDir before creating the data file.
  • Content of data file:
    The created data file is empty, which does not mean that its size is null (the file contains a header describing its structure).
  • The order of items created in the physical file is the physical order of items created in the analysis (and not the logical order).
If the data file already existed: If the data file already existed (same name, same directory), this data file is recreated: the data file contains no record. The index file and the memo file (if they exist) are also recreated. In this case, the integrity constraints are not checked.
Caution: Re-creating the data file is possible only if the data file is not used by another application. If a file currently used must be cleared, use HDelete during a browse. You can also use HDeleteAll to delete all records from a data file.
WINDEVUniversal Windows 10 AppHFSQL ClassicHFSQL Client/ServerStored proceduresHyper File 5.5

Additional files created

When creating a data file, the following files can be created in addition to the data file:
  • An index file (".NDX" extension) if one or more keys have been defined in the file description.
  • A memo file (".MMO" extension) if one or more memo items have been defined in the file description.
  • A log file (".JNL extension). This file is created only if the corresponding option was selected during the file description.
    Universal Windows 10 App This file is not created.
  • A <ProjectName>.REP file. This file contains the list of data files handled by the application. This file is created (or filled) if the management of .REP is enabled (HSetREP). For more details, see .REP file.
    Universal Windows 10 App This file is not created.

Managing passwords

  • The password can be defined:
    • when the data file is created by HCreation.
    • before the data file is created by HPass.
  • If the data file existed and if it was password protected, the data file is re-created, even if the password changes or does not exist anymore.
Caution: The password is independent of data encryption. The data encryption must be configured during the file description in the data model editor ("Details" tab).
Native Connectors (Native Accesses) The password is not associated with a data file but with a database. This password must be specified during the connection (HConnect).

Managing fatal errors when creating a data file

If a fatal error occurs when creating a data file, it may be interesting to continue the program while checking whether the data file was created or not. To do so, we recommend that you perform the following exception process:
WHEN EXCEPTION IN
HCreation(PARENT)
DO
Error("HFSQL error: " + HError())
ELSE
Trace("The file is created")
END
WINDEVUniversal Windows 10 AppHFSQL ClassicHFSQL Client/ServerHyper File 5.5OLE DBNative Connectors (Native Accesses)

Managing non-Latin character sets

If the hChangeCharset constant is specified, the character set used in the data file will be the one specified by ChangeCharset. Sorts, searches, ... on string keys (strings, characters, date and time) will be performed according to this character set.
The character set used can be modified by HIndex.
Remark: The size of string items specified in the analysis is expressed in bytes and not in characters. Depending on the character set used, you may have to increase the item size (if the characters used are coded on 2 bytes for example).
WINDEVHFSQL ClassicHFSQL Client/ServerHyper File 5.5

Replication: Range of identifiers

The automatic identifiers for the files of subscriber replicas are using a range of identifiers that differs from the one used by the file of master replica and by the other files of subscriber replicas.
This range of automatic identifiers is written in the header of each data file (".FIC" extension).
This range is initialized:
WINDEVHFSQL ClassicHyper File 5.5

Priority for defining the location of log files

The location of log files is defined according to the following priority order:
  1. Location specified when creating the logged data file (HCreation).
  2. Location specified by HChangeLogDir.
  3. Location specified in the analysis.
  4. Location of the logged data file.
If another application uses HDeclareExternal on a logged data file, the changes made by this application are saved in the log files specified in the header of the logged HFSQL data file.
HFSQL Client/Server The location of Log files is fixed and it cannot be modified. For more details, see Log files in Client/Server mode.
WINDEVStored proceduresOLE DB

Creating an existing table

If the table already exists, HCreation tries to delete and recreate the table.
For example: Using an Oracle database
  • with the OLE DB "MSDAORA" provider: a new table cannot be created. If the table already exists, the records are erased.
  • with the OLE DB "oraOLEDB.Oracle" provider: the creation of a new table is possible as well as the re-creation of an existing table. However, no index or memo item can be created.
When creating a table, WINDEV and WEBDEV try to create the items in the OLE DB type corresponding to the HFSQL type. If this type is not supported, WINDEV and WEBDEV successively try all the "compatible" OLE DB types until they find a type supported by the OLE DB database.
WINDEVJavaOLE DBNative Connectors (Native Accesses)

Constraints for referential integrity

When creating a table, the referential integrity constraints described in the analysis are not created on the database.
OLE DB

OLE DB Oracle: Creating a table containing a binary memo

Caution: creating an Oracle table containing binary memos fails in Oracle 7.x (because the LOBs are not supported in this version of Oracle).
OLE DB

OLE DB: Creating a table containing automatic identifiers

The automatic identifier will be created in the table only if the OLE DB provider supports the automatic identifiers.
WINDEVJavaNative Connectors (Native Accesses)

Managing indexes

HCreation does not return any error messages if an index cannot be added. The table is created without the index that is causing the problem. In this case, duplicates may be found in an item defined as unique key by WINDEV and WEBDEV if the external database does not support the unique keys.

Creating the data file from its description

The data file can be directly created from its description in the data model editor. To do so, select "Create the data file" and select the directory where the data file must be created.
Native Connectors (Native Accesses)

DATE and TIME items with the Native SQL Server Connector

When using HCreation, the Native SQLServer Connector creates DATE and TIME items if the server version and the client library version correspond to SQL Server 2008 (or later).
Native Connectors (Native Accesses)

HCreation and Native SQLite Connector

HCreation may fail ("database table is locked" error) if:
  • the file to create already exists.
  • an iteration is in progress on another file in the same database.
This is caused by a limitation of SQLite database.
Component: wd290hf.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 07/06/2023

Send a report | Local help