ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
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: Create a table containing a binary memo
  • OLE DB: Creation of a table containing automatic identifiers
  • Managing indexes
  • Create a data file from its description in the data model editor
  • DATE and TIME items with the Native SQL Server Connector
  • HCreation and Native SQLite Connector
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Creates an empty data file (extension ".FIC") with index file, full-text index file, spatial index file and memo file if required.
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.
Note You can activate the automatic creation of non-existent data files in the project description ("Data files" tab in the project description, option "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.
WINDEVWEBDEV - Server codeHFSQL 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)
HCreation(Orders)
Syntax
<Result> = HCreation(<Data file> [, <Password> [, <Path of the JNL file> [, <Path of the JournalOperation file> [, <Options>]]]])
<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 not contain accents. 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 HFSQL data file password is case insensitive.
  • 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.
AndroidAndroid Widget iPhone/iPadPHP This parameter is ignored.
Java Access through JDBC: This parameter is ignored.
<Path of the JournalOperation file>: Optional character string
Access path to the JournalOperation file and to the JournalIdentification file associated with the logged data file. The JournalOperation file contains all the operations performed on the logged data file. 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.
AndroidAndroid Widget iPhone/iPadPHP This parameter is ignored.
Java Access through JDBC: This parameter is ignored.
<Options>: 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 or other types of operations performed on string keys (strings, characters, date and time) will use the new character set.
hNoLinkIntegrity management: links are not updated on the server (creation, modification, deletion as the case may be).
Reminder: by default, when a data file is created, links are updated on the server..
HFSQL Client/Server This constant is only available for HFSQL Client/Server.

PHP This parameter is ignored.
Java Access through JDBC: This parameter is ignored.
AndroidAndroid Widget This parameter is ignored.
Remarks
WINDEVWEBDEV - Server codeiPhone/iPadJavaAjaxHFSQL 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 no longer contains any records.. The index file and the memo file (if they exist) are also recreated. In this case, the integrity constraints are not checked.
Caution: The data file can only be re-created if it is not being 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.
WINDEVWEBDEV - Server codeiPhone/iPadAjaxHFSQL 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 full-text index file (extension ".FTX") if one or more "Full-text index" keys have been defined in the data file description.
  • A spatial index file (extension ".SDX") if one or more "Spatial Key" keys have been defined in the data 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.
    AndroidAndroid Widget iPhone/iPadPHP 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.
    iPhone/iPad 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 recreated, even if the password changes or does not exist anymore.
Attention Password is independent of data encryption. Data encryption must be configured when describing the data file in the data model editor ("Details" tab).
PHPNative 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
WINDEVWEBDEV - Server codeiPhone/iPadAjaxHFSQL 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 or other types of operations performed on string keys (strings, characters, date and time) will use the new character set.
The character set used can be modified by HIndex.
Note: The size of string fields specified in the analysis is in bytes, not 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).
WINDEVWEBDEV - Server codeAjaxHFSQL 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:
WINDEVWEBDEV - Server codeAjaxHFSQL 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.
OLE 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 OLE DB provider "MSDAORA": no new table can be created. If the table already exists, the records are erased.
  • with OLE DB provider "oraOLEDB.Oracle": you can create a new table, or re-create an existing one. 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.
OLE DB

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: Create a table containing a binary memo

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

OLE DB: Creation of a table containing automatic identifiers

The automatic identifier will be created in the table only if the OLE DB provider supports the automatic identifiers.
Native 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.

Create a data file from its description in the data model editor

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: wd300hf.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 11/15/2024

Send a report | Local help