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
  • Function HDeclareExternal: Use with Native Connectors and/or the OLE DB provider
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
HDeclareExternal (Function)
In french: HDéclareExterne
ODBCNot available with this kind of connection
Temporarily imports into the current analysis the description of a data file from an existing HFSQL data file. This data file is opened. To no longer use this File Description, call HCancelDeclaration.
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)Ajax
// Déclaration d'un fichier de données FournisseurWD à partir du chemin complet 
// du fichier HFSQL Classic (extension .FIC comprise)
HDeclareExternal("C:\GestCom\Fournisseur.fic", "FournisseurWD")
IF ErrorOccurred = True THEN
	// Erreur de déclaration du fichier, on affiche l'erreur
	Error(HErrorInfo())
END
Syntax
WINDEVWEBDEV - Server codeReports and QueriesAndroidAndroid Widget iPhone/iPadIOS WidgetMac CatalystJavaUser code (UMC)AjaxHFSQL Classic

Use with Classic HFSQL files (single-user or multi-user) Hide the details

<Result> = HDeclareExternal(<Full path of the HFSQL file> , <Alias> [, <Password>])
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurs. HErrorInfo is used to identify the error.
<Full path of the HFSQL file>: Character string
Full access path to HFSQL data file whose description will be imported (up to 260 characters). This name must contain the path and extension of the data file.
If HDeclareExternal is used in a stored procedure, the file path must be relative to the current database.
LinuxiPhone/iPad Please note: physical file names must be in lower case and without accents.
<Alias>: Character string
Logical name of the data file. This name will be used to handle the data file. This name can also correspond to a Data Source variable.
<Password>: Optional character string
  • Password associated with the data file.
  • Empty string ("") if no password is used.
If the password is specified, it is retained: it is not necessary to specify this password again in future data file manipulation functions..
WINDEVWEBDEV - Server codeReports and QueriesAndroidAndroid Widget iPhone/iPadIOS WidgetMac CatalystJavaUser code (UMC)AjaxHFSQL Client/ServerOLE DBNative Connectors (Native Accesses)

Use with an OLE DB access, a Native Connector, HFSQL Client/Server and an existing connection Hide the details

<Result> = HDeclareExternal(<Data file> , <Alias> , <Connection>)
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurs. HErrorInfo is used to identify the error.
<Data file>: Character string
Name of the data file in the external database.
HFSQL Client/Server This parameter corresponds to the physical name of data file, in relation to the database (extension included). Example: "monfichier.fic" (or if the database has sub-directories: ".\repertoire\monfichier.fic").
If the data file is password protected, this password must be specified with HPass before using HDeclareExternal.
<Alias>: Character string
Logical name of the data file. This name will be used to handle the data file in the current application. This name can also correspond to a Data Source variable.
<Connection>: Character string
Connection to a database. This connection has been defined in the data model editor or described programmatically with HDescribeConnection.
Android Only connections to an HFSQL Client/Server database are available.
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)AjaxOLE DBNative Connectors (Native Accesses)

Use with an OLE DB access or a Native Connector Hide the details

<Result> = HDeclareExternal(<Data file> , <Alias> , <User> [, <Password> [, <Data source> [, <OLE DB provider or Native Connector> [, <Access>]]]])
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurs. HErrorInfo is used to identify the error.
<Data file>: Character string
Name of the data file in the external database.
<Alias>: Character string
Logical name of the data file. This name will be used to handle the data file in the current application.
<User>: Character string
Name of the user of the data source.
<Password>: Optional character string
Password of the data file to open (if there is a password).
<Data source>: Optional character string
Full path of the data source.
<OLE DB provider or Native Connector>: Optional character string
Name of the OLE DB provider or one of the following constants:
hNativeAccessAS400Native AS/400 Connector (optional module)
hNativeAccessDB2Native DB2 Connector (optional module)
hNativeAccessInformixNative Informix Connector (optional module)
hNativeAccessMariaDBNative MariaDB Connector (optional module of WINDEV/WEBDEV)
hNativeAccessMySQLNative MySQL Connector (optional module)
hNativeAccessOracleNative Oracle Connector (optional module)
hNativeAccessPostgreSQLNative PostgreSQL Connector (optional module of WINDEV/WEBDEV)
hNativeAccessProgressNative Progress Connector (optional module)
hNativeAccessSQLAzureNative SQL Azure Connector (optional module, supplied with Native SQL Server Connector)
hNativeAccessSQLiteNative SQLite Connector
hNativeAccessSQLServerNative SQL Server Connector (optional module)
hNativeAccessSybaseNative SYBASE Connector (optional module)
hNativeAccessXBaseNative xBase Connector
hNativeAccessXMLNative XML Connector
hODBCOLE DB provider for ODBC. Allows you to access an ODBC source declared in the ODBC data sources of Windows
hOledbAccess97OLE DB provider for Access 97
hOledbAccess2000OLE DB provider for Access 2000
hOledbAccess2007OLE DB provider for Access 2007
hOledbAccess2010OLE DB provider for Access 2010
hOledbDBase5OLE DB provider for dBase 5
hOledbExcel2000OLE DB provider for Excel 2000
hOledbExcel2007OLE DB provider for Excel 2007
hOledbExcel97OLE DB provider for Excel 97
hOledbLotus4OLE DB provider for Lotus 4
hOledbOracleOLE DB provider for Oracle
hOledbSQLServerOLE DB provider for SQL Server
Caution: To use an OLE DB connection, you must:
  • install MDAC version 2.6 or later (setup performed by WINDEV/WEBDEV and when creating the client version)
  • install the OLE DB provider corresponding to the database used.
<Access>: Optional constant
Configures the type of access to the data file.
hOReadThe data file can be accessed in read-only mode. It is only possible to read records. It is not possible to add or remove records.
hOReadWrite
(default value)
The data file can be accessed in read/write mode. It is possible to read and write new records.
Remarks
  • All the HFSQL functions can be used on the imported data file except for the integrity management.
  • You can import as many descriptions as necessary.
  • This function can be used with data files in XML format.
  • To use HDeclareExternal in a stored procedure:
    • the relative path of the data file must be specified in relation to the directory of the database containing the stored procedure. The path must include the name and extension of the data file.
    • don't use a connection: the current database containing the stored procedure will be used.
  • By default, if the current project:
    • is associated with an analysis, the lock mode applied to the data files is the multi-user mode (the files are not locked when they are opened and they can be accessed by the other applications).
    • is not associated with an analysis, the locking mode applied to data files is single-user: files are completely locked for reading and writing as soon as they are opened.. This mode prevents the other applications from accessing the files already opened by the current application.
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)AjaxOLE DBNative Connectors (Native Accesses)

Function HDeclareExternal: Use with Native Connectors and/or the OLE DB provider

By default, the logical name passed to HDeclareExternal is considered as the only name in the table. It is encapsulated by using the encapsulation characters corresponding to the database or specified by the OLE DB provider before being sent to the database (this is used to manage the table names containing special characters).
To specify a file name composed of <Username>.<Table name> (or depending on the database, <Schema name>.<Table name>) in HDeclareExternal, these names must be already formatted (using encapsulation characters corresponding to the database, or specified by the OLE DB provider).
Example for SQLServer:
The encapsulation characters are " ".
To rename CUSTOMER as DBO.CUSTOMER using HDeclareExternal, you must pass "DBO"."CUSTOMER".
Therefore, the following code must be used:
HDeclareExternal("""DBO"".""CLIENT""", sdClient, "MaConnexion")
Component: wd300hf.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/24/2024

Send a report | Local help